Online retailer Amazon.com, Inc. said Thursday after the markets closed that it swung to a second quarter profit, as sales surged 20%. The company’s quarterly earnings came in as a surprise for Wall Street analysts who were expecting the company to report a loss. The company also gave an upbeat sales forecast for the current quarter.