A stark pickup in government spending, particularly in defense, has helped fuel a broad acceleration in U.S. economic growth in the past year and a half, according to a Wall Street Journal analysis of Commerce Department data.

The U.S. economy has expanded at a 2.9% annual rate since April of 2017, according to the Commerce Department’s tabulations of the nation’s gross domestic product, or output. That growth rate is faster than the 2.2% annual growth rate between mid-2009—when the expansion started—and April 2017.

Faster...