The city’s downtown area, in particular, has become somewhat of a gas station desert, forcing motorists to range farther afield to fill up their tanks.

The number of gas stations across the state has plummeted over the past decade, with an even sharper decline in Greater Boston, making a quick fill-up harder to find.

Massachusetts drivers had best keep a close watch on their car’s gas gauge these days.

The number of Massachusetts gas stations dropped 12 percent between 2005 and 2014, according to data tracked by the US Census Bureau. In Greater Boston, the drop was 14 percent. Nationally, the decline was 5 percent.


Some mom-and-pop operations have been squeezed out by bigger suburban stations. Stricter environmental standards have prompted some stations to close rather than pay for expensive equipment upgrades, analysts say.

But perhaps the main factor for the decline: the soaring value of real estate. Especially in urban settings, land has become so valuable that it has enticed many station owners to sell.

Joe Elias, owner of a longstanding Gulf station at the busy intersection of Boylston Street, Park Drive, and Brookline Avenue in the Fenway, sold the nearly half-acre lot for $16.9 million last month, state records show.

“It’s a matter of numbers — what makes sense financially and what doesn’t,” said Elias, who still owns gas stations in suburban Millis and Medfield. “And what makes sense for pretty much everyone [who runs a station in the city] is to take the money and run.”

Star Market bought the property so it could tear down the gas station and expand parking for an existing grocery store next door, according to a spokeswoman for the company.

Elias, 48, of Wrentham, said he bought the station about two decades ago and hadn’t planned to sell it. A father of three teenagers, he said he envisioned his children would eventually take over the business.


But Elias said his hand was forced by rising property taxes and increasing interest to buy the station’s property, in the middle of a Fenway neighborhood where construction is booming.

Cashing in on gas station property is appealing because the profit margins of selling fuel tend to be slim.

“You don’t make a lot of money selling gas,” said Jeff Lenard, vice president of strategic industry initiatives at the national Association for Convenience and Fuel Retailing. While profits can vary, Lenard estimated that most “make about a nickel a gallon.”

Much of the profit from gasoline sales goes to companies that pump the oil from the ground, refine it, and transport gas to stations. Station owners must also pay to staff the location and have other expenses, like transaction fees on credit card purchases.

Selling gas used to be more profitable, Lenard said. Decades ago, when gas was much cheaper, customers were more loyal to a particular station or brand.

Now, ever cost-conscious drivers tend to go wherever gas is cheapest, driving around to save pennies per gallon. That forces stations to constantly undercut one another’s prices to attract customers.

Stations make most of their profit today not by selling gas, but by selling other products on site, like coffee and snacks in a convenience store.

The lot that was home to this Gulf gas station in the Fenway neighborhood sold for $16.9 million. David L Ryan/Globe Staff

More and more big-box retailers and grocery stores, like Walmart and Costco, are adding gas stations in little-used sections of their parking lots or building new stores with them. Such large retailers “may not even care if they make money selling gas,” Lenard said.


Instead, the stations serve as a way to attract drivers “who come for the gas and then go inside and fill up a shopping cart.”

Stricter environmental standards, including rules passed in the late 1980s requiring stations to upgrade underground tanks where gasoline is stored, have also been blamed.

Nationwide, gasoline use by motorists dipped during the recent recession as people drove less, but rebounded when the economy recovered.

Motor vehicle gasoline consumption hit an all-time high in 2016 of more than 9.3 million barrels per day, data from the US Energy Information Administration show.

The record was set even amid improvements in fuel-efficiency, growing prevalence of electric vehicles, and heightened concern of vehicle emissions contributing to global warming.

Despite their declining numbers, gas stations still aren’t all that hard to find in many suburban areas. In 2014, there were 1,988 gas stations in Massachusetts, according to data tracked by the US Census Bureau.

The exceptions are areas where there are simply too few people to support the businesses, and city centers, where real estate is most expensive.

Grampy’s, the last gas station in downtown Boston, closed its location on Cambridge Street in Beacon Hill several years ago. It was torn down and replaced with a five-story office building.

Its departure has been an inconvenience for delivery drivers at Felcaro Pizzeria next door, according to a manager of the restaurant, Mohammed, who declined to give his last name.


“It’s definitely an issue for our drivers,” he said. “There can be delays because they have to take extra time to get gas.”

The closest station is in Charlestown, he said.

Mohammed recalled one time, since Grampy’s closure, on a “busy, busy, busy day” when a driver got stranded.

“He was waiting until he had a delivery over in that direction [near the Charlestown gas station] but he ended up running out of gas first.”

Matt Rocheleau can be reached at matthew.rocheleau@globe.com. Follow him on Twitter @mrochele