24 hours after lifting the price of Amazon Prime Video in several markets, the big global retailer has reported a net loss for the second straight quarter as they grapple to control costs, their shares rose 12%.

This was despite revenue in the latest period increasing by 7.2% from a year earlier to $121.2 billion.

This was fractionally slower than the 7.3% rise in the first quarter, which had marked Amazon’s slowest growth in about two decades.

Amazon’s losses came in at US$2 billion for the quarter, compared to a profit of $7.8 billion a year ago.

The loss came partly because of the company’s stake in electric-vehicle maker Rivian whose valuation has been falling this year, causing Amazon to book a pre-tax loss of $3.9 billion in the second quarter.

The shortfall in the three months through June followed a loss in the first quarter of 2022 that was Amazon’s first in seven years.

Currently the Company is facing one of their worst periods on record.

Amazon Chief Executive Andy Jassy was only appointed to the role 12 months ago.

The WSJ reports that Amazon’s loss defied analysts’ expectations for a moderate profit in the period, but its revenue grew faster than Wall Street anticipated, helped in part by continued strength in its cloud-computing business.

Amazon’s shares were up more than 12% in after-hours trading, hitting their highest point in about three months—though still down sharply from the start of 2022.

“Despite continued inflationary pressures in fuel, energy, and transportation costs, we’re making progress on the more controllable costs we referenced last quarter, particularly improving the productivity of our fulfillment network,” Mr. Jassy said in a statement.

In a move to cut costs Amazon reduced staff numbers by 6% to 1.52 million.

Cloud-computing and advertising businesses have been reliable growth engines for Amazon. Revenue for Amazon Web Services, the largest cloud-computing company by market share, grew 33% to $19.7 billion in the second quarter.

Amazon’s advertising business, for which the company recently began breaking out financial data, grew 18% to $8.8 billion in the quarter.

The company said it expects its operating income for the third quarter to be between $0 and $3.5 billion, compared with $4.9 billion in third quarter 2021. It expects sales between $125 billion and $130 billion.

Amazon’s core e-commerce business has been struggling with high costs and slowing growth in consumer demand as customers return to in-store shopping. Amazon’s online stores segment, which includes the bulk of its ecommerce operations, experienced a 4% decline in sales for the period. The segment also posted a decline in the first quarter.