There's a train station right in airport at Casablanca, and you buy the tickets (they're cheap compared to train tickets here, I think first class tickets from airport into city and then the four hour trip to Fez for three of us was around $70.00)
You get off at Casa Voyageurs which while it's the main train station, doesn't look like it. Then you find the train to Tangier. From there you take the ferry and then up to Barcelona.
There are buses that take you over on the ferry, but I don't know for sure how they work. There are two companies that do that sort of thing: Supratours and CMT. I didn't take either, but they're nice I hear. We took the cheap rickety souk bus (which wasn't bad, I blogged about it).
There are also very cheap flights to Spain from Morocco.
You don't need a visa if you're a US citizen, it's easy immigration.
Most people speak very good French, and a few words of Arabic go a long way. The people in general were super friendly and the majority do like Americans very much.
Julie