Brave Japan bowed out of the Confederations Cup with its head held high Wednesday after battling to a 2-2 draw against world champion Brazil in their final Group B game.

News photoShunsuke Nakamura of Japan hits a free-kick over the Brazilian wall during their Confederations Cup game in Cologne, Germany, on Wednesday. The match ended 2-2.

Super-sub Masashi Oguro rammed home the equalizer with two minutes remaining as Japan set up a tense finale and threatened to pull off a major upset in front of nearly 45,000 at Cologne Stadium.

But it was the South Americans who booked a semifinal appointment with host Germany thanks to a dazzling display from Ronaldinho, who set up one for Robinho and scored himself either side of a blockbuster from Japan midfielder Shunsuke Nakamura.