African champions to face Spain
Hosts Brazil will face Japan in the opening match of next year's Confederations Cup on 15 June.
The Brazilians will also play Italy and Mexico in Group A of the tournament featuring continental champions.
Saturday's draw in Sao Paulo also pits Tahiti and the yet-to-be decided winner of the Africa Cup of Nations alongside Spain and Uruguay in Group B.
The eight-team warm-up, which will test some of the 2014 World Cup venues, begins on 15 June and 15 days later.
The opener is in the capital Brasilia and the final at Maracana Stadium in Rio de Janeiro.
Brazil, again under the command of Luiz Felipe Scolari, have won three Confederation Cup titles, including the last two in 2005 and `09.
Mexico, Concacaf's Gold Cup winner last year, is the only other participating team to have won the tournament - in 1999 in a final against Brazil at home.
The winner of the African Cup of Nations will be known in February.
Despite only eight nations participating, there was a temporary mix-up during the draw when Uruguay was wrongly put in the third position in Group B.
Fifa general secretary Jerome Valcke showed surprise when a subsequent ball was allotted the same third place, before Uruguay was moved to the correct second slot of Group B.
Four teams had already been allocated to their groups ahead of the draw.
Brazil and Spain were the seeded teams, while Italy and Uruguay were distributed in advance to avoid match-ups from teams of the same continent in the first round.
Fifa said it does not expect Brazil to be fully ready by next June and that the Confederations Cup will not serve as a full-scale rehearsal of the World Cup itself.
"It's a question of trust and confidence when the World Cup is going to a country," Fifa President Sepp Blatter said.
"The football community, they trust and they are confident with the organisation of Brazil.
"I am convinced that Fifa is behind you. Thank you for the wonderful organisation that I'm sure you will deliver for the game, for the world, for Brazil."