After several periods of disappointing results that included rounds of layoffs, Amazon’s second quarter sales and earnings exceeded analysts’ expectations. The costs cuts helped to turn an operating loss of $600 million in last year’s second quarter to a $3.2 billion profit this year, while sales increased 11%, to $134.4 billion.

Amazon’s online business had the slowest growth of all its operations in the second quarter, with sales up 4%, to nearly $53 billion. The modest growth is in keeping with reports from publishers who say that Amazon orders still have not returned to the levels prior to the slowdown that hit last summer. The largest sales driver was a relatively new division, advertising services, where sales jumped 22%, to $107 billion. Its cloud service, AWS, had a 12% increase in revenue, to $22.1 billion, and as usual provided the bulk of its earnings, generating $5.4 billion in profits.

The company expects a solid third quarter, forecasting sales to be between $138.0 billion and $143.0 billion, an increase of 9% to 13% over the third quarter of 2022. Operating income is expected to be between $5.5 billion and $8.5 billion, compared with $2.5 billion in third quarter 2022. The good times may not last, however, as the government is widely expected to file antitrust violations against the company soon.