"The 27 hostages abducted on May 16 in Waza and July 27 in Kolofata were released to the Cameroonian authorities this night," President Paul Biya said in a statement on national radio.
The 10 Chinese citizens and other hostages, who also included the wife of Cameroon's deputy prime minister, were all "safe and sound," he said.
The Chinese were brought to Yaounde airport by military plane, an AFP correspondent said. As was the case in past kidnappings of foreigners blamed on Boko Haram, no details were given on how the hostages were freed.
The July kidnappings were carried out during two simultaneous assaults, also blamed on Boko Haram, in which at least 15 people died.
More From This Section
Cameroon shares a border of more than 2,000 kilometres with Nigeria, where Boko Haram has been waging a bloody insurgency since 2009.
The group did not claim responsibility for the kidnappings, but has been involved in other abductions, including of 200 schoolgirls in a case that sparked international outrage.
Some 10,000 people have died since Boko Haram launched its insurgency in Nigeria five years ago.