Teams must finish in the top two in their group to qualify for the knockout phase
Brazil have been given a difficult draw for the 2010 World Cup and will face Portugal, North Korea and Ivory Coast, regarded by many as Africa's best team.
Hosts South Africa will launch the first World Cup on African soil with a match against Mexico in Johannesburg.
England will meet the United States, Cameroon face the Netherlands, and Germany will play Australia and Ghana.
European champions Spain were given a relatively kind draw and will take on Switzerland, Honduras and Chile.
The draw for the 32-nation tournament was made at a ceremony in Cape Town broadcast to more than 250 million people worldwide.
There were gasps in the audience when three of the strongest nations - Brazil, Portugal and Ivory Coast - were put together in Group G.
"It's a very interesting group," said Brazil's coach, Dunga. "Against Portugal, with their style of play and their players it will be like Brazil against Brazil.
"The big question mark is with North Korea. I will have to take a close look at them. Ivory Coast - they are very strong side."
The West African team's manager, Vahid Halilhodzic, said they had been handed the toughest draw on Friday but would "prepare to create an upset".
Carlos Queiroz, Portugal's coach, said Brazil would be favourites and that his team's match with Ivory Coast would be decisive.
Queiroz excited about Brazil clash
"I think we have a good chance," he told BBC Sport. "Of course, all the groups will be difficult for all the teams."
Germany coach, Joachim Loew, declared himself happy after his side were drawn with Ghana, Australia and Serbia in a strong Group D.
But Loew said the opening match against Australia would be very important as a victory would help build momentum.
"I've got a lot of respect for Serbia. They beat France and easily won their group," he said. "And I wouldn't call Ghana an outsider. They're one of the stronger teams."
Hosts South Africa, currently ranked 86th in the world by Fifa, will face 1998 winners France, Mexico and Uruguay.
We need to be well prepared - SA coach
"There is a good balance between all the groups," South Africa coach Carlos Alberto Parreira told BBC Sport.
"Our group is the only one containing two former world champions. This group is a challenge and we are going to face it."
Marcello Lippi, the coach of holders Italy, said he was "neither satisfied nor upset" to have drawn Paraguay, New Zealand, Slovakia.
"The more you think a group will be easy the more difficult it becomes," he said. "They are all difficult opponents, but then we will also cast an eye on the second round and quarter-final."
Vicente Del Bosque, Spain's coach, said: "We can't complain. We can't hide the fact we are one of the favourites to win."
The Netherlands, ranked number three in the world, must navigate their way past Denmark, Cameroon and Japan.
Two-time champions Argentina are pooled with 2004 European champions Greece, Nigeria and South Korea.
2010 World Cup draw Group A: South Africa, Mexico, Uruguay, France Group B: Argentina, South Korea, Nigeria, Greece Group C: England, USA, Algeria, Slovenia Group D: Germany, Australia, Ghana, Serbia Group E: Netherlands, Japan, Cameroon, Denmark Group F: Italy, New Zealand, Paraguay, Slovakia Group G: Brazil, North Korea, Ivory Cost, Portugal
Group H: Spain, Honduras, Chile, Switzerland