His comments come less than 24 hours after Algerian President Abdelaziz Bouteflika offered to normalise ties with Morocco.
The moves are being seen as a symbol of a desire by both sides to settle a dispute which has seen the two countires at loggerheads for nearly 30 years.
"Morocco reaffirms that it will continue to respond to all goodwill and initiatives reached by consensus that are fair in order to put an end to the problem surrounding this question," King Mohammed said in his annual enthronement speech.
But he cautioned that Morocco was ready, if necessary, to defend with all its might its territorial integrity.
The UN Security Council is due to make an announcement on Thursday on the future of a UN-backed plan for the disputed territory.
Polisario's guerrilla war
Morocco seized the vast, mineral-rich Spanish colony of Western Sahara in 1975.
Soon after Algeria backed the Polisario Front independence movement, which fought a guerrilla war with Rabat for 15 years until a ceasefire in 1991.
The United States is currently pushing a UN resolution that would implement a plan to make sparsely populated Western Sahara a semi-autonomous part of Morocco for four to five years.
A referendum would then let residents choose between independence, continued semi-autonomy or integration with Morocco.
1975 - Morocco annexes Western Sahara
1991 - Polisario and Rabat announce ceasefire
2003 - Morocco and Algeria seek to normalise relations
In an important shift, the Polisario Front independence movement and Algeria have recently backed the plan drawn up by the UN and a resolution that would endorse it.
Morocco has in the past officially been critical of the plan by UN Western Sahara special envoy James Baker.
The European Union and the United States want Morocco and Algeria to normalise ties to enable them to co-operate more at a time when security and illegal migration are high on the agenda.
However, while the land border between Algeria and Morocco has been closed since 1994, bilateral contacts have recently intensified.