Hello, 2 weeks is certainly enough - depends how busy you like it and where all you want to go. check the other posts in the portugal section below for itinerary ideas from newbies like me and more experienced folks like Kathyrn who live there. we have commented in various recent posts from this month.
4-5 days in Lisbon area (lisbon, belem, sintra, cascais, evora overnight if you wish. Lisbon is fun, lots of young folks, good food and people, good weather, not expensive)
2-4 days in Porto area including Duoro
some time in Faro (i did not go here as water was cold in early april)
you may still have time for Spain (barcelona and madrid/toledo will be cooler, have a large young population presence including american, canadian and british visitors - and of course, hispanics)
you could save a bit by booking at good hostels - private rooms if you'd prefer.
can book Spain flights last minute - there are many from Lisbon to Madrid/Barca and they are not expensive (30-80$)
yes, Andalucia will be hot. its seems to be a fantastic area of Spain to visit and I have planned it for future.
P.S. most folks on this forum like it slower - "live like the Europeans" which I want to do someday. but I have limited vacation and budget and I am in the "sightseeing" phase of my life. from my 3 trips to Europe in the past 6 months, I have learned that 3 full days in a city is enough to get a good flavor and do the major activities and sights without much rushing - again depends on your style and needs. Lisbon is interesting because Sintra/Cascais, and Evora are all accessible as day trips from here. Evora comes highly recommended - even as as an overnight trip but I had not planned for it.