What happened 

Shares of Pinduoduo (PDD -1.38%) soared 22.3% on Tuesday after the online retail marketplace generated its first quarterly net profit. 

So what

Pinduoduo's revenue surged 89% year over year to 23 billion yuan, or renminbi ($3.6 billion) in the second quarter. The gains were fueled in part by a 30% jump in average monthly active users, to 738.5 million, and a 24% increase in active buyers, to 849.9 million. 

A person is pointing to an upwardly sloping chart.

Investors cheered Pinduoduo's Q2 results. Image source: Getty Images.

Pinduoduo also delivered a surprise profit. Its net income checked in at 2.4 billion yuan ($371 million) compared to a net loss of 899 million yuan ($139 million) in the year-ago period. 

Moreover, Pinduoduo's adjusted earnings per American depositary share (ADS) improved to 2.85 yuan ($0.44) from a loss of 0.06 yuan in the prior-year quarter. Analysts had expected a per-share loss of 1.88 yuan. 

Now what

Tony Ma, Pinduoduo's vice president of finance, chalked up the company's unexpected profitability to a seasonal moderation in its marketing spending. However, Ma noted that Pinduoduo's planned growth investments will weigh on its margins in the coming quarters. "We do not expect the profitability to continue," Ma said during a conference call with analysts. 

Still, Pinduoduo announced a major new philanthropic initiative to support China's agricultural industry, with a focus on serving rural areas. The company promised to allocate 10 billion yuan ($1.6 billion) to these efforts. 

"This is an important and challenging task, which we will invest in patiently," CEO Chen Lei said in a press release. "All profits from the second quarter and any potential profits in future quarters will first be allocated toward this initiative until the total 10 billion yuan commitment is fulfilled."

The move comes after Chinese government officials called on companies to give back to society as part of the country's heightened focus on "common prosperity." 

"Agriculture has long been at the core of Pinduoduo's corporate mission and strategy and the '10 Billion Agriculture Initiative' we announced today is a way for us to deepen our support for agricultural modernization and rural vitalization," Chen said. "Investing in agriculture pays off for everyone because agriculture is the nexus of food security and quality, public health, and environmental sustainability."