Pepe lies in pain on the Mestalla Stadium pitch on Saturday in Valencia. On Sunday, it was revealed the defender will undergo knee surgery and be out at least six months. ((Javier Soriano/AFP/Getty Images) )

Real Madrid defender Pepe will undergo surgery to repair the ruptured cruciate ligament in his knee, an injury that leaves the Portugal international in danger of missing next year's World Cup.

Madrid announced the severity of Pepe's injury on Sunday after he underwent a scan at Sanitas Hospital La Moraleja. Team Dr. Juan Carlos Hernandez said the centre back would undergo an operation within the next week.

Pepe, 26, came down awkwardly after jumping alongside Valencia striker David Villa to reach a long ball. Pepe was taken off on a stretcher in the 45th minute in Madrid's 3-2 victory at Mestalla Stadium on Saturday.

Madrid director general Jorge Valdano said he would look to sign a defender in the January transfer window, with Pepe set to miss the rest of the season. Madrid is second in the standings with 34 points, five behind Barcelona, which has played a game more.

"Unfortunately, the worst possible omen concerning Pepe's injury has been confirmed," Valdano said. "We'll look at the possibility of compensating the team so that we can feel a little more comfortable."

The Brazil-born Pepe has been a regular in Madrid's starting lineup since joining from FC Porto in 2007 for the equivalent of $46 million Cdn.

Portugal has been drawn in a difficult group at the World Cup in South Africa, containing Brazil, Ivory Coast and North Korea. The Portuguese open against Ivory Coast in Nelson Mandela Bay on June 15.