California's economy has surpassed that of the United Kingdom to become the world's fifth largest, according to federal data made public Friday.

California's gross domestic product rose by $127 billion from 2016 to 2017, surpassing $2.7 trillion, the data said. Meanwhile, the UK's economic output slightly shrunk over that time when measured in U.S. dollars, due in part to exchange rate fluctuations.

The data demonstrate the sheer immensity of California's economy, home to nearly 40 million people, a thriving technology sector in Silicon Valley, the world's entertainment capital in Hollywood and the nation's salad bowl in the Central Valley agricultural heartland. It also reflects a substantial turnaround since the Great Recession.

All economic sectors except agriculture contributed to California's higher GDP, said Irena Asmundson, chief economist at the California Department of Finance. Financial services and real estate led the pack at $26 billion in growth, followed by the information sector, which includes many technology companies, at $20 billion. Manufacturing was up $10 billion.

California last had the world's fifth largest economy in 2002 but fell as low as 10th in 2012 following the Great Recession. Since then, the largest U.S. state has added 2 million jobs and grown its GDP by $700 billion.

California's economic output is now surpassed only by the total GDP of the United States, China, Japan and Germany. The state has 12 percent of the U.S. population but contributed 16 percent of the country's job growth between 2012 and 2017. Its share of the national economy also grew from 12.8 percent to 14.2 percent over that five-year period, according to state economists.

California's strong economic performance relative to other industrialized economies is driven by worker productivity, said Lee Ohanian, an economics professor at University of California, Los Angeles and director of UCLA's Ettinger Family Program in Macroeconomic Research. The United Kingdom has 25 million more people than California but now has a smaller GDP, he said.

California's economic juggernaut is concentrated in coastal metropolises around San Francisco, San Jose, Los Angeles and San Diego.

"The non-coastal areas of CA have not generated nearly as much economic growth as the coastal areas," Ohanian said in an email.

The state calculates California's economic ranking as if it were a country by comparing state-level GDP from the Bureau of Economic Analysis at the U.S. Department of Commerce with global data from the International Monetary Fund.