Brazil will also play Italy and Mexico in Group A of the tournament for continental champions, and Tahiti and the yet-to-be decided winner of the African Cup of Nations will play alongside Spain and Uruguay in Group B.
The draw in Sao Paulo was marked by an embarrassing moment for FIFA after one of the teams was put in the wrong position, prompting Secretary General Jerome Valcke to later apologize.
The eight-team warm-up tournament, which helps the host country test some of its 2014 World Cup preparations, will be played June 15-30 in six Brazilian cities. 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, has 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.
"It will be good to have Italy, Japan and Mexico in our group because these matches will allow us to make good observations about our team," Scolari said. "We hope to have the squad ready and to be competitive during the tournament so we can start making observations for the World Cup."
The temporary mix-up during the draw happened when Uruguay was wrongly put in the third position in Group B. Valcke showed surprise when a subsequent ball — Tahiti — was allotted the same third place, causing an awkward moment. After all the other balls were drawn, Uruguay was eventually moved to the second slot of Group B, meaning an opening game against Spain.
"This never happened before," Valcke said. "It was a bit of a chaotic draw, sorry for that."
FIFA President Sepp Blatter had said during his introduction speech that it would be an easy draw because only eight teams were participating.
FIFA later said the problem didn't influence the result of the draw with Uruguay always set to be in Group B.
"The teams are in the right groups," FIFA Communications Director Walter de Gregorio said.
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 matchups from teams of the same continent in the first round.
The teams playing in next year's tournament have 12 World Cup titles together — five for Brazil, four for Italy, two for Uruguay and one for Spain — the most ever for the Confederations Cup. The previous record was 10 in 2005, when Brazil, Germany and Argentina played.
Brazil will play 2011 Gold Cup winner Mexico on June 19 in the northeastern city of Fortaleza, then faces European runner-up Italy on June 22 in nearby Salvador. Spain plays Tahiti on June 20 at the Maracana in Rio de Janeiro, then closes group play against the eventual African winner on June 23 in Fortaleza.
"We've had good results recently, but we will have to prepare ourselves the best way we can to do well," Spain coach Vicente Del Bosque said. "We can't forget that Uruguay has been playing some of the best football in the world in the past few years."
Tahiti coach Eddy Etaeta said it was an honour just to be playing in the tournament.
"This is unbelievable, we will be playing some of the greatest teams in the world," he said. "It's a privilege to be able to play Spain, which plays the best football today ... We will try to defend the best way we can and limit the goals against us. If we get to score, it will be very special. We are happy to be among the best."
Uruguay coach Oscar Tabarez said he needs to focus past the opener against Spain.
"We know the history of the Spanish team and we know how good it plays," he said. "It will be a great motivation to have this opportunity to play against them. But the decisive game for us will be the second, against the African team. It will give us an idea of our chances of advancing to the next round."
FIFA was upbeat because more than 130,000 tickets for the Confederations Cup have already been sold little more than a week into the pre-sale phase. Less than 10,000 tickets had been sold at the same stage in South Africa in 2009.
FIFA gave Brazil a big vote of confidence by allowing the tournament to be played in six host cities despite some concerns with the pace of preparations in some venues. Recife and Salvador were ratified less than a month ago after showing FIFA they would be ready in time for the competition.
It's the first time FIFA has accepted having the stadiums ready less than six months before a tournament of such magnitude. Only the stadiums in Belo Horizonte and Fortaleza are expected to be ready by the end of this year, which was the initial plan for all six venues.
"We have the mission to win the Confederations Cup on the field, but we also have the obligation to be victorious off the field," Brazil President Dilma Rousseff said. "We are preparing to organize an extraordinary Confederations Cup. We will show the world in 2013 that Brazil has all the conditions to host the 2014 World Cup, and that it will be the best organized and the most festive of all time."
A few protests took place across Brazil at the same time of the draw to complain about the series of government concessions made in favour of FIFA.
FIFA said it doesn't 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, which is expected to attract 500,000 international visitors.
"It's a question of trust and confidence when the World Cup is going to a country," Blatter said. "The football community, they trust and they are confident with the organization of Brazil. I am convinced that FIFA is behind you. Thank you for the wonderful organization that I'm sure you will deliver for the game, for the world, for Brazil."
Also Saturday, FIFA and official match ball provider Adidas presented "Cafusa" as the Confederations Cup ball. FIFA said the name combines three symbols of Brazilian culture: carnival, football and samba. This is only the second time that a specifically designed ball has been launched for the so-called "Festival of Champions."
Follow Tales Azzoni at http://twitter.com/tazzoni