The military operation at the Hotel Byblos in Sevare, popular with United Nations staff, "has ended and the hotel has been cleared", a source said.
Suspected Islamist militants stormed the hotel on Friday, around 600 kilometres north-east of the capital Bamako, killing five Malian soldiers and seizing an unknown number of hostages.
"We freed the four hostages. But unfortunately we also found three bodies at the site," defense ministry spokesman colonel Diaran Kon said.
He did not give the nationalities of the freed hostages or the dead.
A number of people held by gunmen during the standoff were earlier freed, and at least five foreigners evacuated from the site, according to Malian military sources.
The governments of Russia and Ukraine confirmed earlier they each had a national among the hostages, with nationals from South Africa and France also reported to be in the hotel.
An earlier government statement said two militants were killed in the fire fight and seven suspects were detained.