If you are in the planning stages and are not set on flying from Spain, there is a new and fairly reasonable flight on British Airways to Fez, which will put you exactly where you want to be, in the center of the country and by far its most fascinating city.
Aside from that, the previous poster has already mentioned the other cost effective way of getting to Morocco....
oops! forgot to mention, the BA flight is from London.
Tarifa is also a wonderful village in the province of Cadiz, close to Algeciras, which has a shorter ferry to Tangier. They will also shuttle you to and from Algeciras if you have your ticket with them. Algeciras is better connected by bus than Tarifa. Their site is
www.frs.es