(CNN) -- Real Madrid star Cristiano Ronaldo has been ruled out of Portugal's crucial final World Cup qualifier against Malta on Wednesday with an ankle injury and could be sidelined for up to a month.

Cristiano Ronaldo holds his ankle before going off in Portugal's win over Hungary.

Ronaldo played with the injury in Portugal's 3-0 home victory over Hungary on Saturday but lasted just 27 minutes before limping off.

Portugal, who have made a late charge in World Cup qualifying after looking set to make an ignominious exit, need to beat Malta in the home game to be sure of a place in the European playoffs.

The Portugal federation said they had allowed Ronaldo to leave the squad, while Spanish giants Real confirmed the bad news in a statement on Sunday.

"After a clinical examination and an MRI scan, it is confirmed the player has suffered a recurrence of his injury to his right ankle, a medial collateral sprain with inflammation in the bone," the club said.

"The estimated recovery time is three to four weeks."

Denmark have an unassailable lead in Group One after beating Scandinavian rivals Sweden 1-0 on Saturday.