SENEGAL got the result it needed against Uruguay to advance from Group A, but it exhibited its weaknesses in the process.

Pape Bouba Diop scored twice for Senegal, which wasted a three-goal halftime lead and barely held on for a 3-3 tie against Uruguay.

Senegal finished second in the group with five points, two behind Denmark. Both the Senegalese and the Danes upset defending champion France en route to the second round.

Alvaro Recoba equalized for Uruguay with two minutes to play, converting a penalty kick after substitute Richard Morales was brought down in the box by goalkeeper Tony Sylva.

Morales, who scored Uruguay's first goal from point-blank range inside the opening minute of the second half, got his head on a rebound from just four yards out, but directed the potential game-winner wide of the net in the 91st minute. Defender Lamine Diatta then cleared a long-range shot off the goal line.

Diego Forlan, who along with Morales sparked Uruguay in the second period, reduced the deficit to 3-2 after 68 minutes. The Manchester United forward chested the ball and then powered it past a helpless Sylva from 25 yards out.

Khalilou Fadiga converted a penalty for Senegal, which will face the Group F winner in the second round -- either Sweden, England or Argentina. But Fadiga earned a second caution in the match and will be suspended for that next game.

"It feels a bit bitter going out of the tournament, especially because of a decision like that," Forlan said of the penalty against Uruguay. "I was disappointed that our team wasted many good opportunities to score."

After a dominant first half, Senegal conceded the quick goal and failed to find its composure thereafter.

"The goal they got right after halftime really hurt us and it turned into a heart-stopping match," Senegal coach Bruno Metsu said. "But the players showed they are capable of doing great things. We have qualified for the best 16 teams."

In addition to a borderline call on its penalty, Senegal's third goal was allowed despite a suspicion of offside. Some on Uruguay's bench had to be restrained from arguing with the match officials after the final whistle.

"I think we were unlucky, we lost to a goal that should not have counted," Uruguay coach Victor Pua said. "It was a penalty which was not and it was unjust. We did not play for 10 or 15 minutes after that. My team showed they should have got through to the second round."

Fadiga scored with ease from the penalty after Uruguayan goalkeeper Fabian Carini tackled El Hadji Diouf in the area. Bouba Diop netted a beautiful goal on a one-timer. Henri Camara finished a run on the left with a precise pass just inside the box for Bouba Diop.

Bouba Diop hit the third on a volley following Camara's cross on the right, but he seemed dangerously close to being in an offside position.

"Because the first half ended 3-0, the game was easy," Bouba Diop said. "However in the second half, we were disappointed that it ended in a draw, but we are going to the last 16."

Uruguay were determined to make a match of it in the second half, keeping the pressure on and throwing caution to the wind defensively. With the South Americans trailing 3-2, Uruguay keeper Carini kept them in the match, making a save on Diouf's 76th-minute breakaway.

Recoba hit a free kick just wide five minutes later and Forlan did the same with a shot shortly thereafter.

Uruguay outshot Senegal, 14-6, in a physical match that featured a combined 12 yellow cards and 42 fouls.