The New Zealander has been drafted in as replacement for Frenchman Pierre Gasly, who will be competing in the Super Formula finale in Japan instead.
Hartley has fallen off the F1 radar in recent years and focused on sportscar racing, and was the 2015 World Endurance champion with Porsche.
He previously tested for Toro Rosso back in 2009.
United States Grand Prix
Verstappen apologises to FIA after steward criticism
27/10/2017 AT 04:15
"What an amazing feeling," said the 27-year-old.
"This opportunity came as somewhat of a surprise, but I never did give up on my ambition and childhood dream to reach F1.
"I have grown and learnt so much since the days when I was the Red Bull and Toro Rosso reserve driver, and the tough years I went through made me stronger and even more determined.
"COTA is a track I really enjoy and one I have raced at recently.
"I'm trying not to put too many expectations on my F1 debut, but I feel ready for it."
As well as testing for Toro Rosso, Hartley was reserve driver for Red Bull's two teams in 2009 and '10 as part of Red Bull's junior driver set-up.
However, he was dropped by Red Bull soon after and his most recent F1 running was with Mercedes in a test at Magny-Cours in France in 2012.
"Brendon is coming as the reigning 24h Le Mans winner and he's also leading the current FIA LMP1 World Endurance Championship, which he won in 2015 as well," said Toro Rosso team boss Franz Tost.
"We are really happy to have him back in our team. With all the racing experience accumulated over the years, we are convinced that he will do a fantastic job for us."
United States Grand Prix
Hamilton fastest in U.S. Grand Prix practice
20/10/2017 AT 17:12
United States Grand Prix
Bottas learning from defeats to Hamilton
20/10/2017 AT 11:54