When Elizabeth W. Spencer decided to run for Congress in Montgomery County two months ago, she seemed more determined to defeat her longtime antagonist and former school board colleague, Marian Greenblatt, than to serve on Capitol Hill.

She accomplished that in stunning fashion Tuesday night, knocking out the conservative Greenblatt in the Republican primary. As the votes piled up that night, it became obvious that Spencer's mission was not so single-minded, that she really would like to be in Congress and that she will campaign with equal diligence against the incumbent Democrat, Michael Barnes.

"Its' going to be tough, but we are going to take a hard look at his (Barnes') voting record," said John Purcell, Spencer's campaign manager. "Our No. 1 priority now is to raise money and to move the campaign into a totally different class of operation."

The fight against Barnes will be far more difficult than her improbable campaign against Greenblatt. Barnes has emerged as perhaps the most popular elected Democrat in Montgomery County in the past four years, avoiding primary opposition in each of his last two races and winning reelection two years ago with 60 percent of the vote.

As a Republican Spencer will have to overcome her party's historic disadvantage in Montgomery, where only four Republicans currently hold political offices. Spencer has defied the skeptics once already, with her surprising initiation in the political arena. She resigned her seat on the nonpartisan school board last July and, with only two months and about $10,000, assembled a grass-roots campaign to defeat Greenblatt, a candidate who had a professional campaign staff and who initially seemed assured of winning the GOP nomination.

Spencer decided to run for Congress in June, she said, after it became clear that she and her husband, Louis, a government employe, were not going to move to Kentucky, where they own a farm. She said she chose to run as well because Greenblatt, a member of the school board since 1976, and two other candidates did not represent her views or those of other moderate Republicans.

Spencer's campaign was quickly organized, and she converted the basement of her Gaithersburg home into a make-shift campaign headquarters. With a handful of friends and community supporters, with little money (she loaned her campaign $5,000, and received another $5,000 in contributions), and with no direct experience in partisan politics, Spencer began what was viewed by some as a long-shot candidacy to win the party's nomination.

Her candidacy soon caught on -- she received invaluable help from volunteers -- and in the last few weeks party leaders who were distressed by Greenblatt's negative image began to say privately that they would vote for Spencer instead. Spencer also was aided, and Greenblatt hurt, by newspaper endorsements and by the withdrawal of two popular Republican politicians, state Sen. Howard A. Denis and Del. Constance A. Morella, from Greenblatt's steering committee.

"A lot of people out there were looking for an alternative to Marian, and Elizabeth was the treatment," said Allan Levey, the state GOP chairman."

Greenblatt, a controversial school board member since 1976, and Spencer, who was elected to the board in 1974, were ideological rivals who clashed on a variety of education issues. Their contrasting temperaments and styles of leadership, as well, became an issue in the congressional campaign.

The faction of the party that recruited Greenblatt for the race early this year attributed her defeat to a split conservative vote. Forbes Blair, former county GOP chairman, said Greenblatt would have won if she had received the votes that went to the two other conservatives, Phillip N. Buford and Kurt Summers. Greenblatt, in a statement delivered by her campaign manager, said, "Certainly a split in the conservative vote was detrimental to my effort."

Greenblatt phoned Spencer to concede the race about midnight Tuesday, but made no public statements about her loss and has been out of view and unavailable for comment since then.

Republican party leaders said there was no single explanation for Spencer's victory.

"I was surprised," said county GOP chairman Paul Clark, who believed she lacked the finances and time necessary to be successful. "I think she won in large part because of her immaculate reputation as a gentlewoman, as an effective member of the school board, and because she is a solid individual."

"Marian carried the baggage of the school board during a very difficult period," Clark said. "She had a lot of things she couldn't control."

By contrast, Spencer had built a reputation as an even-tempered conciliator on the school board whose firm and well-timed statements on educational policy added to her credibility in the community. She had won respect from a cross-section of community activists who, ideologies aside, trusted her sense of fairness during the turmoil of the past few years.