Montserrat Serra and Blanca Thiebaut, 40 and 30 respectively at the time of their kidnapping from the Dadaab refugee complex near the border with Somalia in October 2011, are both "safe and healthy", MSF said.
"Both are safe and healthy and keen to join their loved ones as soon as possible," the medical charity said, without disclosing when they were released or how.
On Friday, Spain's El País newspaper said negotiations for the release had been carried out by the MSF and not by the Spanish state.
MSF said it would give no further details before a press conference scheduled in Madrid .
The two women are expected to land in Spain on Friday after the country's military sent a plane to Djibouti to collect them, Spanish media have reported.
"Once again, MSF strongly condemns this attack on humanitarian workers who were in Dadaab offering lifesaving medical assistance to thousands of refugees," the charity said.
Serra and Thiebaut, both logisticians, were seized by armed men in the Ifo camp in Dadaab, where they were working on the construction of a hospital, and immediately driven across the border.
Kenyan police said they had been taken by members of Somalia's Islamist Shebab group, but no group has actually claimed the kidnapping.
El País newspaper on Friday reported that the women had not been taken by terrorists but by a criminals with links to Somali pirates.
MSF, which at the time of the kidnapping had 49 foreign and 343 local staff in Dadaab, reduced its activity there to a minimum.
The world's largest refugee complex, Dadaab is home to some 450,000 refugees, the vast majority of whom have fled drought and war in Somalia.
The abduction of the Spaniards followed the kidnapping of a French woman and a British woman from the Kenyan coast near the Somali border.
Briton Judith Tebbutt, in her late fifties, was seized from a remote Kenyan resort on September 11, 2011 by armed men who killed her husband David. She was released in March 2012 after being held for more than six months, reportedly after her son paid a ransom.
Marie Dedieu, 66 and partially paralysed, was seized from her beachfront home in the Lamu archipelago on October 1, 2011.
She was reported dead later the same month, with French officials saying the death was probably due to her having been deprived of essential medication by her kidnappers.
Just days after the two Spaniards were seized Kenya rolled tanks and troops across the border to fight the Shebab.
MSF immediately distanced itself from that operation.
On October 25, 2011 two aid workers with Danish Refugee Council were seized by armed men in Galkayo in north-central Somalia. They were freed in a raid by US commandos in January 2012.
The Kenyan troops were officially integrated into the African Union force in Somalia Amisom in early June 2012.
Kenya is aiming to establish a buffer zone on the Somali side of the Kenya-Somalia border, notably in order to protect its lucrative tourism industry, a pillar of the economy
In January Shebab fighters killed a French hostage, an intelligence agent known under the pseudonym Denis Allex, held since 2009, during a botched rescue attempt by French forces.
A colleague of Allex, kidnapped at the same time, managed to escape in August 2009.
A Briton and a Kenyan employed by an Indian subcontractor of a UN agency and who were seized in southern Somalia in 2008 are feared dead.
An American national kidnapped in January 2012 is still being held.
Thirty-nine seamen of various nationalities from the Naham 3, a fishing vessel captured in March 2012 and from two other boats, are still being held in Somalia.
The fate of a further 15 seamen whose vessel the Albedo sank, is unknown.