Russia booked their spot in the showpiece with a 3-1 victory over Brazil, while a stunning strike from Ivan Shkvarlo sent the defending champions through after a 2-1 win against Iran.
It means the pair will renew rivalries after meeting in the final of both Sydney 2000 and more recently Beijing 2008.
The Russians were made to work hard for their victory, but goals from Viacheslav Larionov, Ivan Potekhin and Aleksandr Kuligin proved enough.
With the Russians taking the brave decision to bench Lasha Murvanadze, who was one booking away from a suspension, they looked nervy early on and Brazil nearly capitalised when defender Ronaldo Almeida de Souza fired a shot from distance against the post.
But Russia found their stride, and they took the lead with a strike from Larionov after 19 minutes to set them on their way.
That lead lasted just seven minutes when Brazil broke at speed and a slick one-two between Wanderson Silva de Oliveira and Jose Carlos Monteiro Guimaraes ended with the former walking the ball into the net.
Russia were spurning their chances, but the introduction of Murvanadze at half-time gave them added impetus and four minutes into the second half they restored their advantage when captain Potekhin headed home unmarked from Aleksei Chesmin's corner.
Muravanadze hit the outside of a post before Russia eventually sealed victory in the 48th minute as Potekhin dispossessed Silva de Oliveira and then broke at pace before setting up Kuligin for a simple finish.
With the Russians' job done, attention then switched to Ukraine - who needed a stunning finish from Shkvarlo to seal their progress.
Jasem Bakhshi's goal with nine minutes left looked to have secured extra-time for Iran after he equalised Ivan Dotsenko's smart finish as he slid the ball under the goalkeeper.
But with three minutes left Shkvarlo unleashed a dipping 30-yard strike that nestled into the corner.
Iran coach Ahmad Janali admitted his side had been beaten by a wonder goal. He said: 'It was a tough game. We did play our best. Both teams played really well, and we have to say congratulations to Ukraine for scoring that goal.'