In the global push to end reliance on fossil fuels, green energy sources like solar and wind power have gotten lots of attention. But geothermal energy is another environmentally friendly energy source. It’s the underground heat left over from the molten rocks that formed Earth billions of years ago, and it can be tapped to heat buildings and generate electricity.

“The Earth is a heat engine,” says William Glassley, an earth scientist at the University of California, Davis, and an expert in geothermal energy. “At depths of 20 miles or more, anywhere on the planet, there is enough heat constantly available to generate sufficient power to supply the entire world.”

Glassley says geothermal power will grow in importance in coming years, as new techniques for finding, tapping and exploiting geothermal energy are developed.

Geothermal resources

Geothermal energy is present even below the coldest parts of Earth’s surface — if you dig deep enough. In most places, Earth’s heat is trapped at depths of more than 20 miles. But in so-called geological hotspots, geothermal energy is near the surface — and is apparent in geysers, hot springs and volcanic eruptions.

The Blue Lagoon, a geothermal spa, is one of the most popular attractions in Iceland. Tom Bell / ortland Press Herald via Getty Images file

People have exploited geothermal energy for tens of thousands of years, using it to cook and bathe, for example. During the Roman Empire, about 2,000 years ago, hot springs were used for public baths and underfloor heating — as in the famous spa town of Bath, England.

Today, geothermal energy tapped via holes drilled in the ground is used to heat and cool houses and other buildings. The underground environment functions as a sort of heat reservoir, with heat being drawn up into a building during cold weather and excess heat being dumped underground to lower indoor temperatures during hot weather.

Get the mach newsletter. This site is protected by recaptcha

The cost of a geothermal heat pump system varies according to the climate and other factors. A typical residential system might be twice that of a conventional heating and cooling system, but geothermal heating and cooling systems can cut utility costs by up to 60 percent.

Geothermal heat is also used in certain industrial and agricultural processes — for example, to dry lumber and crops.

Electricity from underground heat

Geothermal energy is also used to generate electricity.

Geothermal power plants now generate about 0.5 percent of the electricity used in the U.S., which is the world’s leading producer of geothermal electricity. In California, along the geothermally rich region known as the Pacific Ring of Fire, geothermal plants now provide more than 5 percent of the state’s electricity.

Geothermal power plants typically draw energy from so-called production wells drilled to depths ranging from 500 feet to two miles. Steam and superheated water at these depths rise under their own pressure to turn electricity-generating turbines at the surface; waste liquid from the process is captured and returned underground through what are called injection wells.

Nonstop energy

Although geothermal power plants are now built near geological hotspots, Glassley said that could change as techniques for locating and tapping into heat deep underground get better. “Eventually, there will be no geographical limitations for the development of geothermal power sites,” he said, “but that is decades in the future.”

Geothermal power plants cost more to build than typical natural gas power plants, but the cost of operating a geothermal plant is usually far lower. That’s mainly because geothermal power plants don’t require fuel. Fuel costs for a power plant that uses natural gas, oil or coal can be double the cost of building the station itself.

Electricity generated by geothermal plants is often less expensive than electricity generated by wind, hydro power and solar, Glassley said.

Want more stories about clean energy?

FOLLOW NBC NEWS MACH ON TWITTER, FACEBOOK, AND INSTAGRAM.