Hartley was born on 10 November 1989 in Palmerston North, New Zealand, into a motorsport family; his father Brian had competed in multiple categories including Formula Atlantic. After winning the Eurocup Formula Renault 2.0 championship in his second year in Europe, Hartley climbed to the Formula Renault 3.5 Series — at the time one of the most prestigious single-seater feeder categories in Europe, ranking directly below Formula One. He held the status of a Red Bull Junior driver, placing him in an elite talent pipeline that produced multiple Formula One race winners.
Hartley made his Formula Renault 3.5 Series debut in 2009 with Tech 1 Racing, the defending champion team. He combined this campaign with a partial Formula Three Euro Series season with Carlin. His first year in the series proved difficult; he ended fifteenth in the championship while also managing the demands of competing simultaneously in two categories.
For 2010, Hartley returned to Tech 1 Racing for a full season. The team paired him with fellow Red Bull Junior driver Daniel Ricciardo, the Australian who would go on to become a Formula One race winner. Despite the competitive pairing, the season ended in disappointment for Hartley. During the series' summer break, Red Bull announced it was dropping Hartley from its junior programme, citing a lack of race victories across his season and a half in the championship. His seat was subsequently taken by Jean-Éric Vergne, who had been leading the British Formula Three Championship.
Following his departure from the Red Bull programme, Hartley made his GP2 Series debut at Monza as a replacement driver for the Coloni team, broadening his experience while no longer on a factory programme.
In 2011, Hartley returned to Formula Renault 3.5 with the Gravity-Charouz Racing System, driving alongside Jan Charouz. Freed from the specific pressures of a junior programme, he delivered a more settled campaign, recording three podium finishes and placing seventh in the championship. This marked a significant improvement on his previous seasons in the series and demonstrated consistent pace at a competitive level.
His third and final involvement in Formula Renault 3.5 came in 2012, when he was without a drive at the start of the season before returning to GP2 briefly with Ocean Racing Technology. His single-seater career in the top feeder categories effectively concluded around this period as opportunities did not materialise for a progression to Formula One.
The absence of a viable path to Formula One through single-seaters proved to be the turning point that redirected Hartley into endurance racing. With no suitable single-seater drives available following 2012, he joined Murphy Prototypes in the LMP2 class of the European Le Mans Series. This move opened a career trajectory that led directly to Porsche factory status in 2014 and multiple world championships. In hindsight, his Formula Renault 3.5 seasons served as a proving ground that demonstrated racecraft and consistency, even as the immediate results failed to secure him a path to the Formula One grid.
Hartley's Formula Renault 3.5 career, while it did not achieve the championship results that a Red Bull junior programme demanded, provided him with European racing experience at a high level during a formative period. The series itself was one of the definitive stepping stones to Formula One during the late 2000s and early 2010s, and Hartley competed against drivers who would go on to Formula One careers, including Ricciardo. His eventual Formula One debut came not through the junior ladder but through his endurance racing reputation with Porsche, when Toro Rosso called him up in 2017 as an established Le Mans winner rather than a single-seater prospect. His seventh-place finish in Formula Renault 3.5 in 2011 stands as his best championship result in the category, but it is his three Le Mans victories and four FIA World Endurance Championship titles with which he is most associated.