Costa Rica ended 2016 on a particularly green note.

The Central American nation ran entirely on renewable energy for more than 250 days last year, the country's power operator announced.

Renewables supplied about 98.1 percent of Costa Rica's electricity for the year, the Costa Rican Electricity Institute (ICE) said in mid-December. Fossil fuels provided the remaining 1.9 percent.

The country of 4.9 million people gets most of its electricity from large hydropower facilities, which are fed by multiple rivers and heavy seasonal rains.

A worker stands near a dam at a hydroelectric plant run by the Costa Rican Electricity Institute in Guanacaste, Costa Rica. Image: JOE RAEDLE/Getty Images

Geothermal plants and wind turbines are also prominent sources of power, while biomass and solar power provide a tiny but growing share of electricity.

A few diesel-burning power plants round out the electricity mix, but Costa Rica has barely used them in the last two years.

The country enjoyed a 110-day stretch of carbon-free electricity from June 17 through Oct. 6, when the power company briefly turned on its fossil fuel plants. After that blip, Costa Rica resumed its run of consecutive, fossil fuel-free days, a spokesman for ICE told Mashable on Dec. 13.

"Costa Rica's electric grid in 2016." Renewable energy sources are, from left to right: hydropower, geothermal, wind, biomass and solar. Non-renewable energy sources include thermal power plants. Image: Costa rica electricity institute

In 2015, Costa Rica used 98.9 percent renewable energy, slightly more than 2016's expected total.

Compared to larger, more industrialized countries, Costa Rica seems like a verdant gem amid a pile of black coal rocks.

But Costa Rica's smaller economy and natural resources give it an advantage over an energy-hungry powerhouse like the United States.

Costa Rica's population, for instance, is roughly 65 times smaller than the U.S.'s. It also generates about 373 times less electricity than the United States does, according to national energy data from both countries.

Given its huge energy appetite, the U.S. faces a bigger challenge in greening the electric grid.

Wind turbines run by the Costa Rican Electricity Institute are seen along a ridge line in Guanacaste, Costa Rica. Image: JOE RAEDLE/Getty Images

Nearly 15 percent of the U.S. electricity supply for January-October 2016 came from hydropower, wind, solar and other renewable sources, the U.S. Energy Information Administration reported on Dec. 23.

Coal and natural gas together accounted for nearly two-thirds of U.S. electricity generation over that period. Nuclear power provided the remaining 19 percent.

For Costa Rica, the clean energy success story is likely to continue into 2017.

ICE's president Carlos Manuel Obregón said the power company expects renewable power generation to stay "stable" this year, thanks in part to the nation's four new wind farms and favorable hydro-meteorological conditions, which are projected near the nation's hydropower plants.