You will clear Schengen passport control in Barcelona, leaving the international transit zone for the area of the airport devoted to internal Schengen flights. Your Schengen visa issued by Portugal is valid for this purpose.
Because Portugal and Spain are both in the Schengen zone, your flight will depart from the area of the airport devoted to internal Schengen flights, just the same as if your flight were a domestic flight from Barcelona to Madrid. There will be no passport control in Lisbon.
Do I need another transit visa for Spain?
No.
Can I use the transit area of the Barcelona airport?
Yes, and you can (and will) leave it, too.