There are SFO to Barcelona one-stop flights with United Airlines and UA codeshares operated by Air Canada pricing in the $340s for travel in late November and early December. Fares price in $350s for January to March, but dates I checked were Swiss or Lufthansa flights outbound as United codeshares.
I prefer United and Air Canada operated flights for frequent flyer miles earning since Swiss and LH deep discount K economy tends to be primarily useful only for Miles&More redeemable miles.
United Airlines San Francisco SFO – Toronto YYZ – Barcelona BCN – Newark EWR – SFO
One checked bag will cost $60 each way, but carry-on is free.