At the recently opened farmers market outside Houston’s City Hall, Laura Spanjian, the city’s peppy new sustainability director, was in her element.

With a reusable cloth bag tucked under her arm, she bounded around the colorful cluster of stands, shaking hands and pointing out vendors — raw foods! local ingredients! grass-fed Texas beef! — as a Latin band played.

If this does not sound like Houston’s style, well, get used to it. The nation’s fourth-largest city, the sprawling capital of the oil industry, has recently embarked on a variety of green initiatives in an effort to keep up with the times and, it hopes, save money.

The local-food craze is the most visible of these efforts, with the opening of the weekly farmers market in October and the planting of nearby Michelle Obama-style vegetable gardens tended by city hall staff members. But Houston is also transforming itself into an electric-car hub, a national leader in wind-power investment and an advocate for energy efficiency.

“It’s a city rethinking what it needs to be successful,” says Stephen Klineberg, co-director of the Kinder Institute for Urban Research at Rice University.

In recent decades, Klineberg says, as Houston’s economy has diversified beyond oil, the city has realized that it needs to pay attention to quality-of-life issues if it wants to attract talented people.

“Our problem,” he says, “is that people who don’t live in Houston say, ‘Yuck, why would you want to live in Houston?’”

One recent arrival who ignored the yuck factor is Spanjian, who this spring brought her Smart Car from San Francisco and assumed the new position of sustainability director. She had previously worked on greening San Francisco’s transportation and utility sectors. Once in Houston, she promptly organized the farmers market and the vegetable gardens as well as programs to encourage office buildings to save energy.

Asked about the differences between Houston and San Francisco, Spanjian replied that in the Bay Area, “it’s more about greening, less about saving money.” In Houston, she says, “it’s really about both.”

City officials acknowledge that they must go green in a way that is consistent with Houston’s wariness of regulation. This is, after all, the largest city in the country with no zoning. So the city government is trying to lead by example.

“We’re really trying to show you can do this in your own backyard,” says Spanjian, pointing out that the vegetable gardens and the farmers market required minimal expenditures (some of the garden materials came through donations from the H-E-B grocery chain and other groups).

Another Houston initiative, the “green office challenge,” started in September. It encourages businesses to compete with one another to reduce water and energy consumption, with recognition by the mayor and the news media as the proffered incentive. Some 220 businesses are participating.

Separately, the city also plans to use $3 million in federal stimulus money to help offices become more energy efficient by shouldering 20 percent of the cost of improvements.

“It’s the Houston way. We try to persuade, we try to incentivize, we try not to mandate,” says Mayor Annise Parker, who took office early this year.

Parker’s own choices seem emblematic of the new Houston. After spending 20 years in the oil and gas industry, she now drives a hybrid vehicle (though a Toyota Highlander, a sport-utility vehicle), and at home she has a compost bin and collects rainwater.

Some of Houston’s green initiatives were begun under Parker’s predecessor, Bill White, who placed special emphasis on air-quality initiatives. Pollution is a perennial problem for Houston, which remains one of three areas in Texas that does not comply with federal ozone standards. The city will fall even further behind federal requirements when the Environmental Protection Agency announces tighter nationwide ozone requirements, perhaps by year’s end.

White, a former official with the federal Department of Energy, was keen on energy-efficiency, too. His administration approved a measure to change traffic light bulbs to energy-sipping LEDs (light-emitting diodes) from incandescent bulbs. The city will finish replacing bulbs at all intersections next year, with the initiative paying for itself in less than six years, after up-front costs of $15 million.

White also got Houston running on Texas wind power. Today, the city is the nation’s largest municipal buyer of green power.

White encountered resistance, Parker says, when he aggressively prodded refineries that lay outside Houston’s city limits (but affected Houston’s air quality) to cut their emissions. Parker says she would stand up for Houston’s interests, but try not to ruffle feathers unnecessarily.

“I pledged to the other mayors that I wasn’t going to surprise them,” she says.

But even for Parker, things have not always been smooth. A rare city mandate requiring that Houstonians use compostable or biodegradable bags to process their yard waste resulted in phone calls and e-mails from upset residents, who had to pay extra for the bags. The initiative was formulated under White but did not take effect until April. Owners of single-family homes now must put their yard waste out for composting in the bags or compost themselves; the city says the program saves $1.5 million a year due to less lawn cuttings going into the landfill.

Recycling is another challenge. The city’s recycling rate has lagged badly, although it is improving. Roughly 26 percent of the waste from single-family homes, small multifamily units and municipal buildings gets recycled, up tenfold from two years ago, Spanjian says. Two major companies are opening single-stream waste processing facilities in the area.

Perhaps Houston’s most publicized initiative involves electric cars. Starting early next year, the city — which already has plenty of hybrids among its fleet — will become among the first recipients of Nissan’s all-electric Leaf. The city government is expecting to buy 30 of the cars next year with financial help from the federal government. Earlier this month, the electric company NRG Energy rolled out an initiative to put in 50 public charging stations around the city by mid-2011.

Of course, electric cars will do nothing to ease Houston’s infamous traffic and sprawl.

“If you’re going to be a car city, you might as well acknowledge that and help people get into cars that don’t pollute as much,” Parker says.

The city is also considering California-style incentives that would allow electric cars into the high-occupancy-vehicle lanes or reduce their tolls. The city also wants more light-rail lines.

For an oil-and-gas megalopolis that rose out of the swampy bayous, all of these sustainability initiatives amount to, at a minimum, a substantial change of emphasis. Indeed, Klineberg of Rice cites “tons of resistance” over the years from the likes of road builders and oil companies.

Parker, for her part, insists she is not trying to change Houston’s identity as the oil and gas capital — only to make the city ready for the innovators and entrepreneurs of the future.

“I’m not trying to run away from our past — ‘Oh, we used to be oil and gas, and now we’re renewable,’” she says. “Houston has always been about finding a better way to do something.”