By Paul Vieira

OTTAWA -- Data on Friday said Canadian economic output plunged by a record amount in the second quarter, fueled by pandemic-related restrictions on activity, while also indicating that a record expansion is in the offing for the current three-month period.

Canada's gross domestic product, or the broadest measure of goods and services produced in an economy, fell at a 38.7% annualized rate in the second quarter, to 1.820 trillion Canadian dollars ($1.386 trillion), Statistics Canada said Friday. Markets were looking for an annualized drop of 40%, according to economists at Bank of Nova Scotia. This compares with a 8.2% decline in the first quarter.

In comparison, U.S. GDP fell 31.7% at an annual rate in the second quarter.

Meanwhile, Statistics Canada also reported that GDP in June jumped 6.5% from the previous month, following a 4.8% climb in May. The agency estimates economic activity -- measured on an industry basis, excluding spending and investment -- now sits about 9% below February's prepandemic level.

The agency added preliminary information indicates the GDP grew another 3% in July from the previous month.

The economic performance at the end of the quarter, early signs for July and data suggesting the country has recouped over half the three million jobs lost in March and April, have prompted some analysts to predict Canada's economy will post a record expansion in the third quarter. Economists at BMO Capital Markets and Desjardins Securities have both penciled in annualized growth of more than 40% for the July-to-September period.

"The upgrade to June's big rise, itself a record advance, and the solid July gain, point to a mammoth third-quarter increase," said Doug Porter, BMO's chief economist. He added the firm is changing its outlook for 2020, and now estimates a drop for the year of 5.5%, as opposed to its earlier forecast 6% decline.

Growth in the number of confirmed cases of Covid-19 in Canada has slowed markedly since peaks hit in April and May, which were in the 2,000 confirmed cases a day territory. Canada has averaged roughly 450 confirmed new cases a day over the preceding seven days, according to data compiled by Johns Hopkins University. This has prompted jurisdictions across the country to lift many of the restrictions implemented starting in March to contain the spread of the new coronavirus. Overall, Canada has recorded 128,000 confirmed cases of Covid-19, Johns Hopkins data suggest.

Canada is the last of the major Group of Seven economies to formally report GDP for the second quarter. Among the G7, Canada's decline was smack dab in the middle: deeper than the U.S., Japan and Germany, though not as steep as the UK, France and Italy. The decline among advanced industrialized economies is the sharpest in at least six decades, according to figures from the Organization for Economic Cooperation and Development.

Besides recouping a sizable number of lost jobs, Canadian data also suggest retail sales and housing activity have eclipsed prepandemic levels, and manufacturing shipments are also closing in on February levels.

"While we are seeing early and encouraging signs of an economic rebound from the depths of March, uncertainty remains over the timing and shape of the recovery," Dave McKay, chief executive of Royal Bank of Canada. "The real test of the recovery will come once government support programs start to wind down."

Bank of Canada Gov. Tiff Macklem reiterated that point in comments at a virtual symposium organized by the Federal Reserve Bank of Kansas City. He said he is bracing for a "pretty long, bumpy ride" for the economy, and reiterated the central bank would provide support -- either through near-bottom interest rates or large-scale asset purchases, or a combination of the two -- through a protracted recovery.

For the sectors of the economy most affected by the virus, such as hospitality, tourism and travel, "it's going to be very difficult for a long time," Mr. Macklem said.

Write to Paul Vieira at paul.vieira@wsj.com