San Francisco to Barcelona is as low as $319 round trip for travel departures in August 2019 and through October with a variety of Star Alliance airline itineraries. There are deals with Delta too in the $340-$370 range, primarily for Sep-Oct departures. Level/Iberia nonstop flights are as low as $307 round trip for travel in January 2019.
August flights can be searched on Google Flights. Many of these itineraries can be found through United.com or go to Skyscanner or Momondo to find a low cost ticket through a travel agency.
TraveMerry.com Star Alliance Air Canada – Swiss Airlines
San Francisco – Barcelona itinerary
Even more mainstream OTA sites like Cheapoair.com have low fare tickets on these same August dates for a different Star Alliance itinerary for travel on a $375 round trip ticket.