State Representative Martin J. Walsh and Councilor at Large John R. Connolly struggled to differentiate themselves Tuesday in Boston’s first major mayoral debate, as both men appeared hesitant and offered few concrete policy differences to make the case why they should succeed Mayor Thomas M. Menino.

On the handful of occasions when the candidates actually did tussle over an issue, there seemed to be an undercurrent that pitted City Hall (Connolly) against the State House (Walsh). The sharpest exchange came when Connolly criticized Walsh’s ties to organized labor and said legislation he filed to make arbitration binding in labor disputes would devastate the city’s fiscal health.

Walsh defended his arbitration bill, but he waved his hand dismissively at the suggestion that his role as a labor leader and backing from unions would compromise his ability to be an effective mayor. And he said that his labor background would encourage quicker resolution of contract disputes, making arbitration unnecessary.

But more often than not, the candidates found themselves in agreement. Neither would take a no-new-taxes pledge. Both talked about adding diversity to the upper ranks of the Police Department. Both said contraception should be available in schools. Both stressed issues important to seniors.

And they tried to outdo each other in claiming the mantle of education mayor, as Connolly reminded viewers repeatedly of his three years spent as a teacher.

The debate competed with a thrilling Red Sox playoff game on another channel, which certainly drew more viewers. It was a largely cordial affair, and on several occasions, both candidates declined to continue speaking when the moderator offered more time.

At the start of the debate, the candidates — the top two vote-getters in the Sept. 24 preliminary election — were asked how they most starkly differed from their opponent. Both turned to their biographies.

“I’ll let the voters figures out the differences between us,” Connolly said. “What I hope to bring as mayor is my experience as a former teacher going into the classroom every day for three years. . . . You take all of those students’ hopes and dreams with you every day to work in City Hall.”

Walsh talked about growing up the son of Irish immigrants in Dorchester, overcoming childhood cancer, and his struggle with alcohol as a young man.

“It’s kind of shaped who I am today,” Walsh said. “I’ve been on Beacon Hill for the last 16 years, and I’ve worked on issues that we’ve talked about on this campaign. I’ve actually had votes. When we talk about transforming public education, I’ve actually had a vote to transform public education.”

In the debate, Connolly, who taught in schools in New York and Boston after graduating from Harvard University, invoked his experience with a former student, mentioning the student by name in seeking to show the challenges faced by youths in the city. He also told viewers the former student had gotten his girlfriend pregnant.

Connolly apologized after the debate for mentioning the former student by name.

“I was nervous and I made a mistake,” Connolly said in an interview. “I was trying to make an important point on a really important issue, so I apologize on that front, and I will talk to him to make sure he gets my apology.”

The debate, hosted by the Globe and WBZ-TV (Channel 4), marked the beginning of a crucial stretch in the tight race. The candidates will square off twice more on live television in a contest that appears to be close enough that debates could have a significant impact after a crowded preliminary in which almost two out of three voters did not cast their ballot for Connolly or Walsh.

The night represented a significant test for both candidates. It was the first time in their long political careers that either had sat on the big stage provided by live television, facing off against a single opponent.

Both candidates stressed that the city has to find ways to make living in Boston more affordable. “We need to create more opportunities,” said Walsh, who said that the key is bringing in new jobs and companies. “There’s more than one way to bring more money into the city. By growing our economy we will grow our revenue.”

Connolly lamented that the city has a shrinking middle class, with more seniors unable to afford their taxes on fixed incomes and young families unable to purchase a home. “We are increasingly a city of the very rich and the very poor,” Connolly said. “The answer is not to raise taxes.”

The one-on-one televised debate was a stark change from the summer, when the dozen mayoral hopefuls running in the preliminary endured seemingly endless forums. Most were crowded affairs with candidates vying for attention, giving the race the feel of a City Council election. There was one televised debate during the preliminary campaign, but the number of candidates on stage allowed Walsh and Connolly to blend into the crowd.

As Tuesday’s debate wore on, Connolly became more aggressive than Walsh, criticizing his opponent’s deep ties to organized labor. Walsh is a longtime labor leader. Unions and groups funded by labor have spent almost $1.2 million on behalf of Walsh for television ads, mailers, and paid canvassers, according to the state Office of Campaign and Political Finance. Connolly has benefited from $63,500 in spending by education groups.

“I’m just concerned,” said Connolly, “that when your campaign is taking over $1 million in outside money and when you also work in two roles for these unions that will influence what you do when you’re mayor.”

Walsh waved his hand. “I have no comment on that,” he said.

But Walsh suggested his background as a labor leader would help him settle contracts voluntarily with police, fire, and other city unions.

Walsh has been a state representative since 1997, but has been reelected eight times without a serious challenge.

Connolly has won three elections as an at-large city councilor, but those races involved forums in libraries and community centers where he shared the stage with many candidates.

Both praised Menino’s tenure and said they would emulate his devotion to spending time in the neighborhoods and staying in touch with the problems of city residents.

“One of the traits that I have that Mayor Menino has is the ability to go out in every neighborhood and work extremely hard,” Walsh said. “Tom Menino has the pulse of the city.”

Walsh said he would differ from Menino by delegating more power to city department heads and running a more transparent City Hall. A Walsh administration would give new emphasis to economic development, he said.

Connolly vowed to try to match Menino’s focus on supporting the city’s seniors and his fiscal responsibility during the annual budgeting process. The city councilor said he would distinguish himself from the outgoing mayor on education, an issue on which he has clashed with Menino.

“I’m going to be really aggressive and bold in making sure that every child has access to a quality education,” said Connolly.

Globe correspondent Nicholas Jacques contributed to this report. Andrew Ryan can be reached at andrew.ryan@globe.com.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.