Global investment in renewable energy hit $333.5 billion in 2018, the second-highest on record, according to a new analysis from Bloomberg New Energy Finance (BNEF).

That's a 3 percent jump from 2016 and 7 percent short of the $360 billion record set in 2015.

In all, 2017 represented a record 160 commissioned gigawatts of clean energy generating capacity (excluding large hydro) around the world, BNEF estimated. Solar provided 98 gigawatts of that, wind was at 56 gigawatts, biomass and waste-to-energy was 3 gigawatts, small hydro was 2.7 gigawatts, geothermal was 700 megawatts and marine power (energy carried by ocean waves, tides, salinity) was less than 10 megawatts.

"The 2017 total is all the more remarkable when you consider that capital costs for the leading technology—solar—continue to fall sharply," Jon Moore, chief executive of BNEF, commented. "Typical utility-scale PV systems were about 25 percent cheaper per megawatt last year than they were two years earlier."

Solar power dominated half of 2017's total clean energy investments at $160.8 billion, mostly thanks to China's "insatiable appetite" for solar projects, a Bloomberg report noted. China invested $133 billion across all clean energy technologies, with $86.5 billion poured just into solar. The country installed a "runaway" 53 gigawatts of solar capacity last year, BNEF estimated.

Justin Wu, head of Asia-Pacific at BNEF, explained that China's solar boom happened for two main reasons.

"First, despite a growing subsidy burden and worsening power curtailment, China's regulators, under pressure from the industry, were slow to curb build of utility-scale projects outside allocated government quotas. Developers of these projects are assuming they will be allocated subsidy in future years," Wu Said.

"Second, the cost of solar continues to fall in China, and more projects are being deployed on rooftops, in industrial parks or at other distributed locales. These systems are not limited by the government quota. Large energy consumers in China are now installing solar panels to meet their own demand, with a minimal premium subsidy."

But China is not the only country ramping up clean energy investments. The U.S. invested $57 billion—the world's second-biggest backer of renewables despite President Trump's efforts to boost fossil fuels and slash coal regulations.

Large wind and solar project financings pushed Australia up 150 percent to a record $9 billion, and Mexico up 516 percent to $6.2 billion.

Below are the 2017 totals for other countries investing $1 billion-plus in clean energy: