The Moroccan Foreign Ministry said it was recalling its ambassador in Nairobi for consultations.
Morocco "strongly deplores the unjustified and unjustifiable decision" announced by Kenya to recognise "the pseudo RASD (Saharwi Arab Democratic Republic) and to establish with it so-called diplomatic relations," the foreign ministry said in a statement reported by the Moroccan news agency MAP.
Morocco said the RASD was "a virtual entity without any attribute of a sovereign state".
The Kenyan move was "in flagrant contradiction of international law ... and of the appeal by the international community for a negotiated political solution," the statement said.
"The Kenyan authorities have taken responsibility not only for damaging traditional relations ... between two brother countries, but also for excluding their country, by discrediting it, from any possible contribution to the political solution sought in the context of the United Nations."
W Sahara was admitted into the
OAU in November 1984
Morocco notes that "the Kenyan announcement coincides with the launching of a virulent campaign led by the permanent enemy of the territorial integrity of Morocco which has recently repeated its commitment to the creation of an 'independent Saharwi state'," the statement added in a reference to Algeria, chief backer of the Polisario Front which has long fought for independence for Western Sahara.
Kenya on Saturday said its decision was in line with the policy of the African Union, which has recognised Western Sahara's right to self-determination.
"We have established diplomatic relations with them (Western Sahara), this is the first time," said government spokesman Alfred Mutua.
"They are now free to open their embassy or diplomatic representation here in Kenya, but that does not mean we can do the same there.
"This is in line with the fact that the Sahrawi is recognised and admitted as a state in the African Union (AU)," Mutua said.
"This is just an extension of what other countries within the African Union have done."
Diplomatic sources said the agreement was signed in Nairobi on Saturday morning.
Western Sahara, a vast phosphate-rich desert, is a former Spanish colony that Morocco annexed in 1975, declaring it an integral part of the country.
An armed separatist resistance called the Polisario Front proclaimed an independent Sahrawi Arab Democratic Republic with backing from neighbouring Algeria.
"We have established diplomatic relations with them (Western Sahara), this is the first time"
Kenyan government spokesman
Another Kenyan official said representatives from the disputed region have been in Kenya.
The official, who asked to remain unnamed, said the creation of formal ties "was long planned".
"For a long time, we have had a close and informal relationship with that region. We thought it is time to formalise everything," the official said, adding that the east African nation "supports Western Sahara in its quest for independence".
The Western Sahara was admitted into the AU's predecessor, the Organisation of African Unity (OAU) on 12 November 1984. The same day, Morocco pulled out of the pan-African body protesting against the move.
The position has remained the same since the Addis Ababa-based AU replaced the OAU, in 2002.
The United Nations brokered a 1991 ceasefire, but there has been no progress on a UN plan to give the territory autonomy during a five-year transition period before a referendum on independence.
The AMU has been paralysed over
the Western Sahara row
Diplomatic efforts to find a solution for Western Sahara have stalled since Morocco rejected last year the UN-backed Baker plan, named after former US secretary of state James Baker, to grant autonomy to the region for five years and thereafter hold a referendum on self-rule.
Although Algiers and the Polisario Front back the plan, Rabat is opposed to a referendum, preferring instead "widespread definitive autonomy".
In May, a key regional summit of the five-nation Arab Maghreb Union (AMU) was postponed indefinitely because of the dispute between Morocco and Algeria, which have been at odds over the disputed region for several decades.
The row has long paralysed the AMU - comprising Algeria, Libya, Mauritania, Morocco and Tunisia - which was formed in 1989 but has not met for more than a decade.