Where inside the Mexico City airport did you get your visa? Did it require extra time for a layover there to take care of that, or was is a simple process? Thanks.
I don't think you need a "visa", but a "tourist card". In Canada, all the airlines flying to Cuba include it in the cost of the airfare. I have no idea regarding flying out of Mexico whether it is included, or purchased separately from airline or Mexican authorities.
I suggest you go to the Cuba forum in tripadvisors which has a well-developed discussion on this subject. You could also call your airline customer service and ask them.
And if you are a US citizen it is still illegal to travel to Cuba except for approved programs.
Reply to above, but YMMV.
http://gadling.com/2009/07/25/u-s-man-tries-fails-to-get-get-arrested-for-travel-to-cuba/
It's important to note that the news report about the guy trying to get arrested for going to Cuba was dated 2009. The situation is far different today.
I don't know where the OP is located, but a flight from Canada may be an easier option (based on the comments I saw on Rick's Blog).