In pouring rain on a ragged field, Germany and Uruguay staged a match entertaining enough to be for the World Cup title.
Too bad it was only for third place.
Sami Khedira scored in the 82nd minute to give Germany a 3-2 victory and third place for the second straight World Cup. But the Germans had to survive a final-second free kick by Uruguay star striker Diego Forlan from just outside the penalty area. It ricocheted off the crossbar, and the whistle sounded.
Rain-soaked players shook hands and awaited a medals ceremony that was not nearly what they wanted. The Netherlands and Spain will play for the championship on Sunday in Johannesburg.
Germany coach Joachim Loew, his voice still hoarse from the flu, said his team was going home ''with a very good feeling.''
''We achieved more than we perhaps expected,'' Loew said.
Khedira's header after the Uruguay defense failed to clear a corner kick by Mesut Oezil ended Uruguay's hopes of beating Germany for the first time in 82 years.
''We had hoped for more, and we did everything for it,'' Khedira said. ''This was some kind of final and we did everything for it.
''We have a young team and set an exclamation mark here and can reach more.''
Uruguay came from behind to lead 2-1 when Forlan brilliantly volleyed in Egidio Arevalo's 51st-minute cross for his fifth goal of the tournament.
Germany defender Marcell Jansen tied it five minutes later with a header after goalkeeper Fernando Muslera misjudged a cross.
In the dying moments, on a rain soaked pitch, Uruguay had one more opportunity. But Forlan, who has been especially dangerous on free kicks, hit the bar.
''Obviously it's something spectacular to be among the top four,'' said Forlan. ''If someone would've asked us at the beginning, we would've liked it. It's something positive.''
Uruguay has beaten Germany only once in 10 matches, in 1928. Germany beat Uruguay in the third-place match in 1970, the last time Uruguay reached the semifinals.
In its last three World Cup tournaments, Germany was runner-up in 2002 and third in 2006 at home.
''Luckily, we won, because the disappointment over the semifinal was still there,'' Bastian Schweinsteiger said. ''We were behind and we rallied, that shows the character if this team. I am very proud of this team although I have tears in one eye because we did not reach the final.''
Uruguay won the first World Cup in 1930 and also won it in 1950. Germany has won in 1954, 1974 and 1990.
Thomas Mueller opened the scoring for Germany in the 18th minute, also his fifth goal at the World Cup. Edinson Cavani equalized for Uruguay in the 28th when he slid a shot past goalkeeper Hans Joerg Butt.
Miroslav Klose's aching back prevented him from playing for Germany and he finished the tournament with four goals and 14 for his career. He is one goal shy of Brazilian forward Ronaldo's World Cup record and, at 32, doesn't expect to play in 2014 in Brazil.
Loew was forced to make five changes to his team. Defender Philipp Lahm and forward Lukas Podolski were out with the flu. Backup striker Mario Gomez also has the flu.
In an action-packed match, Butt made two good saves on Luis Suarez and Forlan after his team's second goal. The 36-year-old veteran, who was the third-string goalkeeper in 2002, got his World Cup debut replacing Manuel Neuer.
Suarez returned from a one-game suspension for a handball on the goal line against Ghana in the quarterfinals. He saved a goal, Ghana missed the ensuing penalty kick on the final play of extra time, then Uruguay won the shootout.
''I don't think it's too much vanity to think that if we improve a little we can aspire to certain prominence in future international tournaments,'' Uruguay coach Oscar Tabarez said.