While SFO to Barcelona for $537 is not necessarily a good May 2017 ticket price given recent low fares, this American Airlines deal is a great deal for mid-August travel with ticket prices in $540s.
United Airlines is competing from San Jose SJC with similar prices for same travel period. British Airways also has similar prices from SJC to Barcelona.
These are the kinds of discount fares we can expect in 2017 with both SJC and SFO competing for European traffic.
American Airlines San Francisco SFO – Charlotte CLT – Barcelona BCN – CLT – SFO
United Airlines San Jose SJC – Newark EWR – Barcelona BCN – EWR – SJC
American Airlines San Francisco SFO – Charlotte CLT – Barcelona BCN – Chicago ORD – SFO