Gov. Robert L. Ehrlich Jr. has gained significant ground in his re-election bid over the past year, though his Democratic opponent, Baltimore Mayor Martin O'Malley, holds a solid lead built on the backing of moderate voters and strong support from the state's most populous areas, according to a new Sun poll.

The survey indicates that a majority of Maryland voters are pleased with the leadership of their Republican governor at a time when President Bush's approval rating hovers at an all-time low. Yet voters give higher marks to Democrats when asked which party they trust to tackle the state's problems.

Those contradictions set the stage for a close political fight pitting a popular incumbent who appears relatively unscathed by his national party's woes against a Democratic challenger who has been eyeing higher office for years.

With four months to go until the Nov. 7 election, O'Malley leads Ehrlich 46 percent to 38 percent, with 16 percent of voters undecided, according to the poll of 1,200 likely voters interviewed July 6-10. The survey, which had a margin of error of plus or minus 2.8 percentage points, was conducted by Potomac Inc., an independent Bethesda-based polling company. The last Sun survey, released in November, showed O'Malley ahead by 15 percentage points.

Ehrlich's job approval rating is 55 percent statewide, while 36 percent disapprove of how he is doing his job and 10 percent say they are unsure. In November, 50 percent of voters approved of the governor's performance.

In contrast, six in 10 Marylanders say they disapprove of the job Bush is doing.

Potomac Inc. President Keith Haller said he sees shadows of the 2002 gubernatorial contest in the latest results.

"We're seeing this divide again - call it Maryland's political divide," Haller said. "This election is up for grabs."

O'Malley holds big leads in Baltimore, Montgomery County and Prince George's County, liberal strongholds that have in the past carried Democrats to victory.

Support for Ehrlich - who is seeking to become the first Maryland Republican governor returned to office since Theodore R. McKeldin in 1954 - is concentrated in Anne Arundel County and the state's more rural areas.

Four years ago, the governor built a win on support from suburban and rural counties, and the poll shows that - compared with the November survey - he is regaining momentum in those areas.

The race is most competitive in Baltimore County, from which Ehrlich hails, the survey shows. The governor, whose boyhood home is in Arbutus and whose parents still live there, holds a 4-percentage-point lead in the county over O'Malley.

In 2002, Ehrlich pummeled Democrat Kathleen Kennedy Townsend in Baltimore County, with his victory margin there making up nearly his entire statewide edge.

This year, O'Malley and his running mate, Del. Anthony G. Brown of Prince George's County, are showing strength in the predominantly Democratic city of Baltimore, carrying 67 percent of the likely vote over Ehrlich's 16 percent. O'Malley is also ahead of Ehrlich in Montgomery County, 55 percent to 28 percent. The mayor leads in Prince George's County, 62 percent to 19 percent.

O'Malley no longer faces a primary challenge from Montgomery County Executive Douglas M. Duncan, who withdrew from the race last month after receiving a diagnosis of clinical depression. O'Malley had led Duncan in polls, and the county executive had struggled to expand his base beyond the state's most populous jurisdiction.

Meanwhile, Ehrlich, who is running with state Disabilities Secretary Kristen Cox, has a 50 percent to 37 percent lead in Anne Arundel County. Howard County is split, 45 percent for Ehrlich to 42 percent for O'Malley.

The poll's margin of error rises for smaller subgroups, such as counties.

O'Malley and Ehrlich are drawing loyal support from their respective parties, leaving the race to be decided largely by those with loose ideological ties.

Nearly one out of every two voters who describe themselves as "moderate" favor O'Malley, the poll shows. The mayor is supported by 47 percent of moderate voters; 34 percent back Ehrlich.

Still, said Harry Basehart, a Salisbury University political science professor, Ehrlich's high job approval rating indicates that he has the potential to attract crossover support as he did four years ago.

"I think Ehrlich, being a Republican governor in a Democratic state, has done a fair job in terms of policies," said Basehart, a Democrat. "I don't think he has done anything really bad, but ... Maryland is a Democratic state, and come November, Democratic voters may decide that they want a Democrat back in office."

The mayor has an advantage with women, though his draw with them has diminished since the November poll, when he had a 21 percentage point lead. The latest poll shows O'Malley ahead by 11 percentage points with female voters.

At the end of June, Ehrlich named Cox, 36, to replace Lt. Gov. Michael S. Steele on his ticket; Steele is running for U.S. Senate. Haller said the poll was conducted too soon after the selection to gauge whether the governor got a bounce with women from the pick. Ehrlich has made other recent efforts to move to the political center - a territory he needs to occupy to be successful in a state where Democrats outnumber Republicans nearly 2-1 - including advocating for stem cell research.

Theresa Bouma, 40, an independent who voted for Ehrlich in 2002 but will probably back O'Malley this year, said she does not believe the governor has been "particularly effective." A psychotherapist who lives in Beltsville, Bouma said Ehrlich has not invested in the state's public schools - especially those in working-class communities.

"I wonder if Mayor O'Malley might have a better sense of quality and fairness across the board," said Bouma, whose husband is a math teacher.

Economic issues, including fast-rising electricity rates, are on the minds of many voters, the poll shows. With economic unease percolating, incumbent candidates could be punished at the polls, political experts say, but Ehrlich has maintained high marks for managing the state's fiscal affairs.

Only one in five likely voters said they think the Maryland economy is getting better, while one in four said it is getting worse and about half said their confidence in the state's economy remains about the same.

Democrats and African-Americans were pessimistic about the economy, while Republicans and conservatives had a more optimistic view.

Forty-six percent of voters believe Ehrlich would be better at handling the state's economy, compared with 39 percent for O'Malley - although, by nearly the same margin, voters said the mayor would better control electricity prices.

"That sounds more positive than I would have guessed," said Ross Eisenbrey, vice president of the nonpartisan, liberal-leaning Economic Policy Institute in Washington. He said voters nationally are anxious about the economy, which typically translates into anti-incumbent sentiment. "Maybe [Maryland voters] are looking nationally and not blaming the leaders statewide."

Stanley Dunaj, a registered Republican from Baltimore, said he sees the city's economy struggling and is concerned about local crime. A New York City native who moved here in 2001, Dunaj, 65, said he'll support the governor. O'Malley, he said, has not done enough to boost the city's tax base.

"I haven't seen anything but posturing," Dunaj said. "I don't think he has any plan of action."

But Carol Noble, a Rockville Democrat who voted for Townsend in 2002, said she believes Ehrlich lacks an interest in "the common man." A retiree, Noble, 66, said she is concerned that with the rising costs of gasoline and insurance, among other things, people will have trouble making ends meet.

"The only thing that I can think of that Governor Ehrlich's done is ads," she said, referring to the governor's ubiquitous television tourism spots that show him helping families prepare for Maryland vacations. "He can come pack my car."

Voters' educational background is also an indicator of whom they favor in this year's gubernatorial contest. People with more advanced degrees are more likely to vote for O'Malley.

"I think in Maryland we've seen - both in presidential and state politics - that the more education you have, the more inclined you are to support the Democrats," Haller said. "The postgraduate group, they're, for example, the most angry about Iraq and the most upset with Bush."

Haller said Ehrlich has worked hard to craft a public persona that is friendly to "blue-collar Democrats" - those Democrats that might have supported Republican Ronald Reagan's presidential bids.

More than half of voters with postgraduate work - 55 percent - support the mayor, while 32 percent back the governor. In contrast, those with a high school degree or less favor Ehrlich, 42 percent to 38 percent, a difference that is within the poll's error margin.

The economy is not the only thing on voters' minds. Education leads the list of issues Marylanders want to see their politicians address, with one in five identifying it as the most important challenge facing the state today. The economy and jobs comes in second, followed by energy costs, taxes, crime, the environment and health care. Although the city's schools typically score the lowest on state tests, voters in the poll said O'Malley was more likely to improve education as governor.

That's not how Vernon Chilcote of Manchester, in Carroll County, sees that issue shaking out. The 59-year-old Republican said he does not trust O'Malley with schools.

"He lacks all credibility on education," Chilcote said.

Haller said that the gubernatorial campaigns have many issues to emphasize as they seek to sway unaffiliated voters and those still undecided - groups he said will determine the close contest.

"The one thing that is clear to me is that you've obviously got two titans. You've got a reasonably popular Republican incumbent and you've got a high-profile mayor," Haller said. "And the race has tightened."

jennifer.skalka@baltsun.com doug.donovan@baltsun.com