The economy grew at a faster pace than expected in the first quarter and posted its best growth to start a year in four years.

"We're knocking it out of the park," President Donald Trump told reporters at the White House on Friday.

First-quarter GDP expanded by 3.2 percent in the first quarter, the Bureau of Economic Analysis said in its initial read of the economy for that period. Economists polled by Dow Jones expected an increase of 2.5 percent in the first quarter.

It was the first time since 2015 that first-quarter GDP topped 3 percent.

Exports rose 3.7 percent in the first quarter, while imports decreased by 3.7 percent. Economic growth also got a lift from strong investments in intellectual property products. Those investments expanded by 8.6 percent.

Disposable personal income increased by 3 percent, while prices increased by 1.3 percent when excluding food and energy. Overall prices climbed by 0.8 percent in the first quarter.

Friday’s data was the first look at how the economy fared during the longest government shutdown in history. The federal government ceased operations for 35 days between late December and Jan. 25 amid a standoff between Trump's administration and congressional leaders over funding for a wall along the U.S.-Mexico border.

Investors were closely watching out for the report as they looked for more confirmation that a recession may not be in the cards over the short term.

The report “helps offset fears of slowing global growth,” said Alec Young, managing director of global market research at FTSE Russell. “At a time of lingering U.S.-Chinese trade uncertainty and weak economic data everywhere from Germany to Korea to Japan, strong U.S. data acts as an insurance policy against further global economic weakness."