Captain Michael Ballack scored with a blistering free-kick in extra time to lead 10-man Germany to a 4-3 win over Mexico and claim third place in the Confederations Cup on Wednesday.
Ballack's shot from just outside the box curled over the wall and beyond Mexican goalkeeper Oswaldo Sanchez seven minutes into extra time, giving Germany victory after Mexico had equalised three times in the opening 90 minutes.
Lukas Podolski, Bastian Schweinsteiger and Robert Huth scored for Germany. Jared Borgetti scored with two headers and Jose Fonseca got the other for Mexico, who were playing extra time for the second time in four days.
Third place gave Germany, who lost striker Mike Hanke to a red card nine minutes into the second half, some consolation after losing 3-2 to world champions Brazil in the semi-finals.
Mexico, who upset Brazil 1-0 in the group stage, were beaten in their semi-final by Argentina 6-5 on penalties.
Germany, who will be hosting next year's World Cup, got off to a slow start but improved after Henke hit the crossbar midway through the half.
GERMANY STRIKE
Sebastian Deisler in midfield and right back Andreas Hinkel repeatedly tore through the left side of Mexico's defence before Podolski broke the deadlock in the 37th minute.
Teed up by Schweinsteiger, the 20-year-old's superb shot from the left flew into the far corner of the net, beyond the reach of a diving Sanchez.
Mexico levelled just three minutes later after Torsten Frings carelessly lost the ball in midfield to Zinha, who set up Fonseca for a low shot past keeper Oliver Kahn.
Schweinsteiger restored Germany's lead within a minute, tapping in at the far post after a cross from Hinkel, only for his team to go a man down after the break.
Hanke was red-carded for clattering into Carlos Salcido after the defender had cleared the ball and Mexico soon equalised -- Borgetti beating centre back Per Mertesacker to a cross from Luis Perez.
Despite the setbacks, Huth blasted home Germany's third from close range off a corner from Schweinsteiger in the 79th minute.
Germany's defence was caught napping again five minutes from time when Borgetti headed Mexico's third, but Ballack's sweetly-struck free kick in extra time sealed the victory for the host nation.