The dead included seven Lebanese, four Egyptians, one Saudi and one Sudanese, said a ministry official quoted by state-run Saudi TV and the Saudi Press Agency.
The nationalities of the remaining four fatalities have not yet been determined, he said.
Interior Minister Prince Nayef and some other Saudi royals had private homes near the compound. "It was about half a mile from one of the houses of Prince Nayef," the diplomat said on Sunday.
The huge explosion that gutted the Muhaya compound in the west of Saudi Arabia's capital occurred after Western nations issued fresh attack alerts and Washington shut its missions in the kingdom, the world's biggest oil exporter.
The diplomat said the compound might have been chosen as a "soft target" after a recent tough crackdown by security forces.
Mainly Arab and sub-continent
expats lived in the compound
'Obedience or violence'
Leading Saudi dissident Dr Saad al-Faqih agreed that this was likely, blaming the kingdom’s authorities for provoking violence.
“By closing the small margin for (political) expression, the state has done nothing to prevent attacks,” he told Aljazeera.net. “Every citizen has become a victim of this massive security campaign.”
He claimed that the clampdown, with attacks on peaceful demonstrators and widespread searches by security forces, had built-up resentment among ordinary people.
“Those who want to protest against the regime are left with two choices, obedience or violence,” he said.
He conceded that al-Qaida – the only group capable of such an attack, he said - did not represent ordinary Saudis’ wishes by targeting soft targets, such as Western and expatriate compounds, rather than regime symbols.
“By closing a small margin for expression, the state has done nothing to prevent attacks"
Dr Saad al-Faqih,
'Crime against innocents'
Witnesses said there was heavy gunfire when the bombers drove two apparently explosives-packed cars into the complex, which had security guards. One resident said most of the people living in the compound were Lebanese, Egyptians and Syrians.
"This is a crime against innocents which is in the style of al-Qaida. It is an al-Qaida operation," a Saudi security source told Reuters. "This is a suicide operation."
As rescuers searched amid rubble and raging fires, a Saudi-based senior Western diplomat said: "We don't have an exact toll and this is initial, but our best guess is that between 20 to 30 were killed and 50 to 100 were injured."
The attack, in the Muslim holy month of Ramadan, occurred nearly six months after triple bombings at Riyadh housing compounds on 12 May killed 35 people, including nine Americans.
Bin Ladin threat
An audio tape purportedly from Usama bin Ladin released to Aljazeera last month promised more attacks inside and outside the United States.
A Jordanian resident at the compound, who identified himself only as Alaa, described what he heard during the attack.
"I heard shots, many shots, and then one big explosion. "Many villas were damaged, four or five even collapsed. My house was far away but my windows were shattered," he told Reuters.
"This is a crime against Arabs and Muslims and innocent people and those who carried out this evil act are defiling Islam"
"Four villas out of a total of 200 villas are occupied by Westerners, the rest are Arab nationals," Hanady al-Ghandakli, director of Muhaya compound, told al-Arabiya, which is partly Saudi-owned.
"There is one French family, one British family, two German families, Italians," she said.
Arab television reports said three Americans and three Canadians of Arab origin were among the casualties.
"This is a crime against Arabs and Muslims and innocent people and those who carried out this evil act are defiling Islam," one survivor told al-Arabiya.
Saudi forces have killed five Islamist dissidents in clashes since Monday.
On Friday, the United States issued its second security warning on Saudi Arabia in almost as many weeks, saying "terrorists" were planning attacks in the kingdom.
US missions were shut in the kingdom on Saturday, and diplomatic staff and their families were ordered to remain in their homes for a security review.
Britain's embassies in the neighbouring Gulf states of Bahrain and Qatar warned British nationals of a high threat of attacks against Western targets in those countries.