By Harriet Torry and Sharon Nunn, Wall Street Journal

A year of strong economic growth in 2018 ended on a softer but still solid note, with the nation’s economic output slowing from boom-like conditions at midyear to a modest pace.

Gross domestic product, a broad measure of the goods and services produced across the U.S., rose at a 2.6% annual rate in October through December, adjusted for seasonality and inflation, the Commerce Department said Thursday. Economists surveyed by The Wall Street Journal expected a 2.2% reading.

The 2.6% reading fell short of the 3.4% growth rate in the third quarter and 4.2% in the second. The pace of economic activity slowed as consumers reined in spending and the housing market continued to drag on growth, according to the report.

There are two ways to measure annual growth. One is to measure the nation’s total output for 2018 compared with total output for 2017. by that measure–which offers a look at broader trends—the economy grew 2.9% last year, matching a rate last seen in 2015.

The second way is to measure output in the fourth quarter of 2018 versus the fourth quarter of 2017. By this measure—which gives a look at more recent trends—the economy grew 3.1% last year.

Many economists expect a more muted pace of growth in 2019 due to weaker global growth and waning effects of 2017’s tax-cut boost, although the U.S. economy still has strong support from low unemployment and rising incomes. The Federal Reserve predicts 2.3% growth in 2019.

Consumer spending, which accounts for more than two-thirds of the economy, rose at an inflation-adjusted, annualized rate of 2.8% in the fourth quarter, pulling back from the third quarter when it rose at a 3.5% rate. While Americans boosted spending on big-ticket items, their spending on services and nondurable goods slowed.

The slowdown in consumer spending offset positive developments like a pickup in business investment and a rise in U.S. exports. Nonresidential fixed investment—which reflects spending on software, research and development, equipment and structures—advanced at a 6.2% rate, a pickup from a 2.5% rise in the third quarter.

Exports rose at a 1.6% rate in the fourth quarter, after a 4.9% decline in the third. The Commerce Department attributed the upturn to petroleum and capital goods exports. Still, the modest increase in exports was outpaced by the increase in imports, which rose at a 2.7% rate, making foreign trade a slight drag on growth in the fourth quarter.

The housing sector was a headwind for growth for the fourth quarter in a row as residential investment fell at a 3.5% annual pace. The decline likely reflected higher short-term interest rates and tax-code changes that diminished decades-old perks that encouraged homeownership.

The $1.5 trillion tax cut passed by Congress in 2017 formed the ​backbone of President Trump’s plan to boost economic growth to the above-3% growth that marked the robust expansions of the 20th century.

Federal government expenditures were up at a 1.6% annual rate in the fourth quarter. The report said reductions in federal government services due to the partial government shutdown, which began on Dec. 22, subtracted about 0.1 percentage point from GDP growth in the fourth quarter.

Inflation pressures were subdued in the fourth quarter. The price index for personal-consumption expenditures increased at a 1.5% pace in the fourth quarter, in part due to falling oil prices. Core prices—which exclude food and energy—rose at 1.7% rate.

The release of the Commerce Department’s fourth-quarter gross domestic product data was delayed by roughly a month due to the partial government shutdown. The agency also released its first and second estimates for the fourth-quarter together.

“The initial fourth quarter estimate is based on source data that are incomplete and subject to updates,” the agency said.

Overall growth in the first quarter, now in its ninth week, is shaping up on the softer side; forecasting firm Macroeconomic Advisers on Wednesday projected a 1.2% growth rate for GDP in the first three months of the year.

Write to Harriet Torry at harriet.torry@wsj.com and Sharon Nunn at sharon.nunn@wsj.com