(CNN) -- Three-time champions Germany finished third for the second successive World Cup after coming from behind to defeat Uruguay 3-2 in Port Elizabeth on Saturday night.
Sami Khedira headed the winning goal with eight minutes to play as Joachim Low's much-changed team won the bronze-medal match in South Africa.
"Of course we had all hoped for something better, but this match for third place was also a final that we absolutely wanted to win," Khedira said, AFP reported.
"At this World Cup we were a very young team and we've put down a marker. But we obviously want to win more in the future."
Thomas Muller put Germany ahead in the 19th minute on his return from suspension after missing the semifinal defeat by Spain, joining the tournament's top scorers with his fifth goal of the competition.
Edinson Cavani leveled nine minutes later after Germany's stand-in captain Bastian Schweinsteiger was dispossessed, and two-time champions Uruguay took the lead six minutes after the halftime interval as Diego Forlan also netted his fifth goal with a superb volley.
Germany equalized five minutes later when Marcell Jansen headed home after Uruguay goalkeeper Fernando Muslera failed to cut out Jerome Boateng's deep cross.
Forlan hit the German crossbar with the final play of the match from a stunning free-kick as the South Americans finished the tournament on a losing note.
"Finishing among the top four teams is spectacular," he said.
"At the beginning we never thought we'd taste a moment like this. We wanted to finish third, but we'll remember the positives."
Low left captain Philipp Lahm and goalkeeper Manuel Neuer on the substitutes' bench along with four-goal striker Miroslav Klose, who had been struggling with a back injury and missed out on the chance to join Brazil's Ronaldo as the all-time top World Cup scorer on 15 overall.
Lahm's replacement Dennis Aogo was lucky not to be sent off for a bad early tackle on Diego Perez, but Germany had the ascendancy as Arne Friedrich headed Mezut Ozil's corner against the Uruguay crossbar in the 10th minute.
The 20-year-old Muller made no mistake as he pounced to score the opening goal after Muslera was deceived by Schweinsteiger's swerving shot and could only spill the ball into the German's path.
It put the Bayern Munich player, who has represented his country only eight times, on five goals for the tournament along with Spain's David Villa and Wesley Sneijder of the Netherlands.
If that duo fail to score in Sunday's final, Muller may win the award for top scorer as -- bizarrely -- assists are taken into account in the case of a tie, and he has three to their one.
But Schweinsteiger turned villain soon after when he was dispossessed by Perez, who fed Luis Suarez -- and the Uruguay striker found Cavani with a well-timed pass which left veteran goalkeeper Hans-Jorg Butt exposed.
Suarez, returning from suspension, was booed by large sections of the crowd almost every time he touched the ball due to his deliberate handling on the line against Ghana in the quarterfinals.
With rain lashing down, he should have put Uruguay ahead just before halftime but screwed his shot wide of the post.
The 36-year-old Butt, whose third and previous international outing was in 2003, did well to deny Cavani and Suarez after the break but could do nothing as Forlan volleyed in a right-wing cross from Egidio Arevalo Rios in the 51st minute.
The lead did not last long as Muslera was once again caught out, allowing Jansen a free header after flailing at Boateng's towering right-wing center.
Khedira gave 2002 runners-up Germany the lead in the 82nd minute as Uruguay failed to clear Ozil's corner and the midfielder was able to place his header over the despairing Muslera.
Substitute Stefan Kiessling should have made it 4-2 but blazed his shot over the bar, then Forlan almost took the match into extra-time when his ferocious free-kick boomed to safety off Butt's bar.
The result meant that the octopus which had correctly predicted all of Germany's previous results at the tournament was right once again.