South African commandos overran three houses in suburban Maputo in their raid Friday against black nationalist guerrillas but had to retreat in disarray, leaving behind dead and wounded, witnesses quoted in a dispatch from Mozambique said yesterday.

Mozambique counted 13 dead, including a Portuguese passer-by, in the predawn South African attack on exiled black nationalists in a Maputo suburb, Portuguese radio said. The South African defense force had announced in Johannesburg that 30 black nationalists and two white South African commandos were killed.

South African officials said the raid was launched against command posts of the outlawed African National Congress. The South African military chief, Gen. Constant Viljoen, said the commandos had safely returned with numerous captured documents.

Zimbabwe, South Africa's northern neighbor, also has been accused by Pretoria of supporting the congress.

In Salisbury, Zimbabwean Prime Minister Robert Mugabe denounced the raid as blatant aggression. Mugabe, who led his own seven-year guerrilla struggle from neighboring Mozambique against white-minority rule in what was then Rhodesia, said in a statement the attack was "a signal warning to us, not only to proceed with speed to strengthen our defense forces, but also to consolidate our military alliance with our Mozambique brothers."