They were sloppy, trailed early and didn't look like world champions. But in the end, the Brazilians were still too good for Denmark's giant-killers.

With a pair of goals from Rivaldo and Ronaldo in a new role as playmaker, Brazil edged Denmark 3-2 on Friday and moved into the World Cup semifinals.The Brazilian defense fell apart at times against a plucky and carefree Danish team that was happy just to reach the quarterfinals for the first time ever, having upset Olympic champion Nigeria 4-1 in the previous round.

And just two minutes into the game, the Danes were at it again when Martin Jorgensen stunned the four-time World Cup champs with a goal off a pass after a free kick.

With goals from Bebeto and Rivaldo, Brazil had a 2-1 lead at the half. A blunder by Roberto Carlos led to Brian Laud-rup's tying goal early in the second half, but Rivaldo scored his second goal to clinch the victory.

The Danes could have tied the score again, but Laudrup shot wide from close range and Marc Rieper's header hit the crossbar with two minutes left.

"This was a victory of courage," Brazilian coach Mario Zagallohe said. "This was a true World Cup game: beautiful, frank and open. All games should be like this.

"Ronaldo showed that is he is not only about goals. His two plays were spectacular."

Denmark had some spectacular plays of its own and had a chance for a shocking upset.

"I am very proud of my players' performance," said Denmark's Swedish coach, Bo Johansson. "They were almost as good as the best team in the world."

They were better at the very start of the game.

After Dunga fouled Peter Moller just outside the penalty box, the Danes took the free kick quickly and Laudrup slipped free down the left side. With the Brazilian defense slow to see the danger, he pulled the ball back to the unmarked Jorgensen, who shot the ball past Taffarel from 12 yards out.

The Danes' lead was short-lived. The Brazilians tied the score in the 11th minute when Ronaldo, at the midfield line, passed to Bebeto, who outran defender Thomas Hel-veg and shot the ball past goalkeeper Peter Schmeichel for his third goal of the Cup.

The Brazilians managed to slow down the fast pace of the game before striking again in the 26th minute.

The Danes were punished for losing possession 30 yards from their own goal, and Ronaldo wasted no time in passing to Rivaldo. The midfielder had Bebeto alongside as they ran clear of the defense, but he needed no help as he drove the ball past Schmeichel with a high, angled shot.

Down 2-1 at the half, the Danes came out strong and tied the score in the 51st minute on a Brazilian mistake.

Roberto Carlos, facing his own goal, tried a spectacular overhead kick to clear the ball but barely made contact. Instead of flying upfield, the ball bobbled straight to the grateful Laudrup, who shot it past Taffarel from close range.

Rattled by the goal, the Brazilians struck back and regained the lead 10 minutes later on Rivaldo's low 35-yard shot in the corner of the net as the defense backed off him.

It should have been 3-3 with 12 minutes remaining when Helveg got behind the Brazilian defense and pulled the ball back to Laudrup, who shot wide from right in front of the goal.

Two minutes from the end, the Brazilians were almost caught again when a cross found Rieper unmarked and his header struck the top of the crossbar.

"It was the spirit of our game which saw us through," said Brazilian defender Cafu, who will miss the semifinal after collecting his second yellow card. "We are always running for the ball."

Brazil plays the winner of the Argentina-Netherlands game in one semifinal Tuesday. France, which beat Italy in a penalty shootout, plays the winner of the Germany-Croatia game in the other semifinal on Wednesday.