Consumers spent more than expected on the e-commerce giant’s site, while margins tightened at the company’s all-important cloud computing division.