Yar'Adua had not been seen in public since November, when he went to Saudi Arabia for treatment of an inflammation of tissue around his heart. He was diagnosed with that condition, acute pericarditis, last fall after he complained of chest pain.
He returned to Nigeria in February but had remained out of sight.
Vice President Goodluck Jonathan has served as the country's acting leader since Yar'Adua fell ill.
Yar'Adua took office in 2007 in an election mired in controversy and accusations of vote-rigging.
"There was ballot snatching, voters were molested, voters were beaten ... and also payment inducement to vote for certain candidates," said Eneruvie Enakoko of the Civil Liberties Organization, a human rights group in Lagos.
The president, a soft-spoken and unassuming figure who did not bask in the media spotlight like past leaders of the West African nation, pledged to fight to improve the country of 150 million people despite the accusations.
"Our collective goal is to deliver for our children a Nigeria better, stronger, more peaceful, more secure and more prosperous than we met it," Yar'Adua said.
President Barack Obama issued a statement late Wednesday expressing his condolences to Yar'Adua's family and the Nigerian people.
"President Yar'Adua worked to promote peace and stability in Africa through his support of Nigerian peacekeeping efforts as well as his strong criticism of undemocratic actions in the region," Obama said in the statement. "He was committed to creating lasting peace and prosperity within Nigeria's own borders, and continuing that work will be an important part of honoring his legacy."
His election followed wide support from his predecessor, leading critics to label him a puppet of the former president, Olusegun Obasanjo.
After he was elected, Yar'Adua replaced some of Obasanjo's top officials, including the head of the army, a move analysts said was aimed at shedding off his predecessor's influence.
One of Yar'Adua's biggest successes was offering amnesty to militants in the troubled oil-rich Niger Delta region, a move that brought fragile peace to the area after years of conflict. The well-armed Niger Delta rebels have been battling Nigeria's armed forces over oil profits, which they say are unequally distributed.
While he has hospitalized in Saudi Arabia, the militants called off the truce, dealing a blow to plans to end violence that has crippled oil production in the nation.
Analysts say he did little to institutionalize reform in a country where two-thirds of the population lives on less than a dollar a day.
"Because many people feel disillusioned economically and as long as they have those sentiments -- I think the risk of radical uprisings in places like northern Nigeria and certainly southern Nigeria in the Delta will continue regardless of who is in power," said Rolake Akinola, an analyst at Control Risks West Africa.