Harvard law professor and consumer advocate Elizabeth Warren shakes hands as she arrives in Lowell, Mass. (Elise Amendola/AP)

Sen. Scott Brown (R-Mass.) and Elizabeth Warren, a Democrat who is challenging him for his seat, signed an agreement Monday that discourages outside spending in their hard-fought Senate race, which has been inundated with millions of dollars in advertising by super PACs and other independent groups.

The pact marks a groundbreaking attempt by the candidates to gain control over outside spending, which has proliferated this year in the wake of court rulings that made it easier for corporations, unions and wealthy individuals to raise and spend unlimited amounts of money on political campaigns.

It’s unclear how effective the agreement will be, however, because candidates are prohibited from coordinating with independent groups.

Under the deal, Brown and Warren pledged to pay a penalty of 50 percent of the cost of any TV or Internet advertising by an outside group, regardless of whether the ad is aimed at supporting themselves or attacking the other candidate. The money would be given to a charity of the opposing candidate’s choice.

The rivals agreed to ask broadcast stations to enforce the pledge.

Brown told Fox News Channel that the deal will provide “an incentive to keep these groups out” with “real teeth.”

“People are hurting. They want to understand how the particular candidates are going to draw distinctions and get their vote, earn their vote,” he said. “They don’t need these outside groups trying to buy elections and do things inappropriately.”

Warren said in a statement that she and Brown “have now moved beyond talk to real action to stop advertising from third-party groups.”

“Both campaigns will need to remain vigilant to ensure that outside groups do not try to circumvent what is an historic agreement,” she said. “This can give Massachusetts voters a clear choice come Election Day.”

The campaign pact comes amid a wave of spending, particularly on the Republican presidential race, by a new kind of unrestrained political action committee called a super PAC. These groups, officially unaffiliated with the candidates they support, have spent nearly $30 million on the GOP primaries, mostly on attack ads.

Super PACs and other types of outside groups have been spending big on the Senate contest in Massachusetts, and it’s not clear how many will be dissuaded by Brown and Warren’s agreement.

The League of Conservation Voters, a major funder of ads opposing Brown, signaled that it probably will abide by the call to stand down.

“While we cannot take directions from any candidate on our independent activities, we are inclined to respect the people’s pledge agreed to by Elizabeth Warren and Scott Brown,” Senior Vice President Navin Nayak said, adding that “we hope that Scott Brown will honor his end of the deal” if conservative groups continue to fund ads.

Crossroads GPS, a super PAC affiliated with the conservative American Crossroads group, which has run ads attacking Warren, declined to comment on whether its strategy might change in light of Brown’s decision.

But American Crossroads President Steven Law complained in a statement that the agreement will allow labor groups to spend money on phone banks, direct mail and get-out-the-vote drives.

“Warren’s latest agreement has loopholes the Teamsters could drive a truck through, the longshoremen could steer a ship through, the machinists could fly a plane through, and government unions could drive forklifts of paperwork through,” Law said.

Even without outside spending, the Brown-Warren race is shaping up to be one of the most expensive U.S. Senate contests in history. The two candidates brought in a combined $9 million in the last three months of 2011, putting them on pace to challenge the $70 million raised in the 2000 Senate race in New York between Hillary Rodham Clinton (D) and Rep. Rick Lazio (R).

Just last week, Warren’s campaign said the candidate raised more than $1 million during a one-day “money bomb” fundraising effort.

Super PACs emerged after a series of court rulings — including the January 2010 Supreme Court decision in Citizens United v. Federal Election Commission, which permitted corporations and unions to spend unlimited amounts of money on campaigns. The largest groups formed to take advantage of the rulings have favored Republicans, although Warren has benefited more than Brown from outside spending in Massachusetts.