CNN — Amazon is starting the year back in the black. The e-commerce giant on Thursday reported a profit of $3.2 billion for the first quarter, up from a loss of $3.8 billion in the year ago quarter and far exceeding analysts estimates. The swing to a profit comes as Amazon (AMZN) has ramped up its cost-cutting measures in recent months. The company has announced two rounds of layoffs, canceled products and nixed physical store expansions. It also comes as key areas of Amazon’s business continuation ue to grow Despite lingering recession fears possibly weighing on corporate and consumer spending. The company’s revenue increased 9% during the quarter from the prior year. Amazon expects second-quarter net sales to grow between 5% and 10% from the same period the year before, or be between $127 billion and $133 billion. “The results indicate that ongoing cost-cutting measures are having a positive impact on Amazon’s business prospects,” said Jesse Cohen, senior analyst at Investing.com. “Amazon’s strong guidance for Q2 revenue is another indicator that the company may be starting to come out of the woods.” Amazon Web Services, which has long served as a profit engine for the company, also experienced double-digit percentage growth during the quarter, in another positive sign for its overall business. AWS segment sales rose 16% from the year before to $21.4 billion. That comes after sales growth slowed in the previous quarter, as cloud customers tightened their purse strings due to uncertainty about the economy’s health. “While our AWS business n avigates companies spending more cautiously In this macro environment, we continue to prioritize building long-term customer relationships,” CEO Andy Jassy said in a statement accompanying the earnings release.