A Malian soldier and two other civilians, one Chinese and the other Gabonese, were also killed.
An al-Qaeda-linked group said it carried out the attack near the capital Bamako. Mali has been fighting a jihadist insurgency for years.
Islamist fighters are roaming the West African country’s north and centre.
“It is a jihadist attack. Malian special forces intervened and hostages have been released,” Mali Security Minister Salif Traore told AFP news agency after Sunday’s attack.
Four assailants were killed by security forces and four others were arrested, he said.
“We have recovered the bodies of two attackers who were killed,” he said, adding that they were searching for the bodies of two others.
One of them left behind a machine gun and bottles filled with “explosive substances”, he said.
The ministry said another two people had been injured.
A security ministry spokesman told Reuters news agency that 32 guests had been rescued from the Le Campement Kangaba resort, east of Bamako.
Malian special forces intervened, backed by UN soldiers and troops from a French counter-terrorism force.
Witness Boubacar Sangare was just outside the compound as the attack unfolded.
“Westerners were fleeing the encampment while two plainclothes police exchanged fire with the assailants,” he said.
“There were four national police vehicles and French soldiers in armoured vehicles on the scene.”
He added that a helicopter was circling overhead.
The European Union training mission in Mali, EUTM Mali, tweeted that it was aware of the attack and was supporting Malian security forces and assessing the situation.
Earlier this month, the US embassy had warned of “possible future attacks on Western diplomatic missions, other locations in Bamako that Westerners frequent”.
BBC correspondent Alex Duval Smith says many expats and wealthy Malians go to Kangaba at weekends, to enjoy the pools, cocktail bar, canoeing facilities and activities for children.
A spokesman for the Portuguese armed forces, Helder Antonio da Silva Perdigao, said that the location is used by soldiers in the EUTM Mali as a place to relax between operations.
He added that soldiers from several countries were there at the time of the attack.
The Portuguese soldier who died was part of the EUTM Mali, he said.
In November 2015, at least 20 people were killed when gunmen took guests and staff hostage at the Radisson Blu hotel in Bamako.
Al-Qaeda’s North African arm, Al-Qaeda in the Islamic Maghreb (AQIM), said it was behind that siege.
Mali has been in a state of emergency since the Radisson Blu attack. It was extended for a further six months in April.
The country’s security has gradually worsened since 2013, when French forces repelled allied Islamist and Tuareg rebel fighters who had seized control of much of the north.
French troops and a 10,000-strong force of UN peacekeepers have been battling to stabilise the former French colony.
Source: BBC News