Hitting four home runs for the first time this season, the Boston Red Sox overcame a three-homer inning by Baltimore and defeated the Orioles, 7-6, tonight to split a pennant-pressure doubleheader before 40,877, the third-largest crowd of the season in Memorial Stadium.

In the first game, the Orioles ended a five-game losing streak by defeating the Red Sox, 7-2, as Dennis Martinez (11-9) pitched the team's first complete-game victory since June 26.

When the Orioles scored six runs in the fourth on home runs by Eddie Murray, Lenn Sakata and Jim Dwyer, it appeared that Baltimore, with a 6-3 lead, was headed toward a sweep and would catch Boston in the loss column.

It was still 6-4 entering the eighth and reliever Ross Grimsley had retired six Red Sox in a row. But Carney Lansford hit his sixth homer, and before Coach Cal Ripken Jr., filling in for ejected Manager Earl Weaver, replaced Grimsley, Dave Stapleton followed Wade Boggs' single with his first homer in more than a month. It left the disgusted Grimsley discussing early retirement.

"(Rich) Dauer came off and said they were stalling for time, but nobody ever did anything, so I just went ahead," Grimsley said. "These guys are busting their humps and something like this happens. This is it. This is my last year."

Boston relief ace Mark Clear, after yielding Dwyer's three-run homer in the fourth, faced the minimum 16 batters the rest of the way, as the Orioles reverted to the batting form they showed during their losing streak. Clear, in his longest assignment during two seasons with the Red Sox, threw 44 strikes in 67 pitches and struck out five.

Boston, with its 32nd comeback victory of the year, trails first-place Milwaukee by a half-game in the American League East. Baltimore is four games back.

Weaver and umpire Ken Kaiser quarreled from the first inning of the opener until Kaiser ejected Weaver in the third inning of the second game.

Their differences started when Jim Rice, the third batter of the first game, hit an opposite-field fly ball that struck the top of the fence a couple of feet inside the right field foul pole, hit a fan in the chest and caromed onto the field.

That, at least, was the version of Kaiser, the first-base umpire. Weaver and right fielder Gary Roenicke disagreed, contending the fan had reached over the fence and touched the ball before it landed.

Since Carl Yastrzemski then hit a liner to Sakata at second, Orioles' fans could speculate a ground-rule double would have been followed by a double play, with no runs scoring.

In the second, Baltimore left fielder John Lowenstein leaped and thwarted Dwight Evans' bid for a three-run homer with his glove above the fence.

The Orioles finally rallied, scoring seven runs on eight hits in the fifth and sixth innings.

The big hit was a two-out, tie-breaking, two-run single in the fifth by Dauer, who had been in an eight-for-58 slump. That was the third straight two-out hit by Baltimore, following a run-scoring single by Rick Dempsey and an RBI double by Al Bumbry.

Dempsey, the hottest-hitting Oriole of recent weeks (15 for 32), knocked in two more in the sixth with a single between the legs of reliever Luis Aponte. Dempsey did not play in the second game.

Meanwhile, Martinez turned stingy after his inauspicious start, yielding eight hits and two walks.

"It's a long time, isn't it?" said Martinez, the last Oriole to go the route and win when he beat Detroit here 33 games ago. "Rice hit a pretty good pitch and the ball stayed up. It was a lucky shot and I wanted to settle down, not have to say, 'Well, here we go again.' "

Martinez had been knocked out in the third inning or earlier in three of his last four starts.

Sammy Stewart also started slowly in the second game, as Evans put one over Lowenstein's glove and the fence in the first inning. Four hits in the second inning made it 3-0 before the Weaver-Kaiser sideshow interrupted the proceedings in the top of the third.

With a ball-two count on Boggs and two out, Kaiser pointed toward the dugout, from where he had been hearing disparaging words for some time, and walked toward it. Weaver came out and marched toward the plate. They passed each other without a word and Kaiser stepped into the dugout and grabbed a towel while Weaver talked to catcher Joe Nolan. The return journeys turned into a Keystone Kops confrontation in which each took turns imitating the other.

Kaiser raised his right index finger; so did Weaver. Weaver turned his cap around and Kaiser copied him. When first-base umpire Bill Haller tried to push Weaver away, Weaver staggered backward in mock disarray.

There was only one possible outcome, of course. Weaver was ejected for the 87th time in his career. The only surprise was that it was the first time Kaiser has ejected him.

"Anyone that's got eyes could see that wasn't a home run tonight," Weaver said. "And I had eight of my nine hitters come in griping about what he's calling. I've got to stand up for my players. I want to win as much as they do and it's a shame that that kind of thing goes on. I wonder how he can get himself involved at third base tomorrow. I guess we'll have to stop at second every time."