In addition to a couple of planes leaving for Spain, there are some good ferry connections between the Spanish enclave Melilla and Spain proper. Many do not want to go all the way down to Gibraltar/Algeciras, and then there are good reasons to visit the eastern parts of Morocco, uncovered by many travellers. As long as you don't leave Melilla, you're still in Spain. Practicalities take place on the crowded border crossing some kilometres out of centre of Melilla.
Waiting for services at this border can take hours, so bring your patience, or meet early in the morning. Rules have it that you could be asked for proof of self-sufficiency, but showing a credit card together with some money (do not show any dirhams if you have bought these in Melilla) should be enough.
Heading out of Melilla, the first place you pass is the fast growing city of Nador (which also has ferry connection, but limited to France), whereafter the main road divides into two possibilities, the coast to the east and the magnificent city of Fez, or the lively city of Oujda and the desert.