Two of those released are French, while the other two are said to be an American woman and a South Korean woman.
Two French soldiers were killed during the rescue raid, the statement from the French presidency said.
The French hostages had been kidnapped in neighbouring Benin on 1 May.
Their release was secured through a military operation conducted on Thursday night in the north of Burkina Faso, the Elysée palace said.
Frenchmen Patrick Picque and Laurent Lassimouillas disappeared in the remote Pendjari National Park in Benin where they had been on safari. Their local guide was found dead.
The park is on the border with Burkina Faso where Islamist militants have been increasingly active in recent months.
No further details of the other two hostages liberated were given.
President Emmanuel Macron congratulated "the French armed forces for the liberation of the hostages, and includes everyone who worked alongside them", the government statement said.
"He bows with emotion and solemnity before the sacrifice of our two soldiers who gave their lives to save those of our citizens," it added.