An hour before the game, Baltimore Orioles Manager Earl Weaver sat slumped in his office, rubbing red eyes and well into his second pack of cigarettes.

He had had a 7 a.m. wakeup call, a 9:30 train ride and now, before his team had to face Ron Guidry, a band of bagpipes was 45 minutes into a rehearsal session outside his office. "It's going to be one of those days," Weaver said.

No, for Weaver and the Orioles, it was the best of days. John Shelby and Cal Ripken tagged Guidry for homers, and Scott McGregor allowed six hits over seven innings tonight as the Orioles beat the New York Yankees, 5-2, to move into second place in the American League East.

In winning for the 17th time in 25 games, the Orioles improve to 31-20 and four percentage points in front of the 32-21 Yankees, who have now lost five of seven.

In doing so, the Orioles also pushed aside a couple of ghosts. Specifically:

They'd lost 10 straight games at Yankee Stadium. Their last victory here was June 17, 1984.

They matched their 1985 victory total against the Yankees. Last season, they went 1-12 (0-7 at Yankee Stadium).

They saw McGregor break a six-game losing streak to the Yankees. McGregor had been zero for five in personal matchups with Guidry.

The game drew a big, noisy crowd of 36,511 to Yankee Stadium and was played in a slow, steady rain. Guidry (4-5) was as shaky as the weather, losing his fourth straight and allowing 10 hits and four runs in 5 1/3 innings.

Ripken (three for four) hit a bases-empty homer off Guidry in the first and Shelby had a two-run shot in the second. In all, the Orioles had 11 hits off four Yankees pitchers.

The other bright offensive spot for the Orioles was third baseman Floyd Rayford, who broke out of an zero for 29 slump with a single and double in four at-bats.

The rest belonged to McGregor (5-4) and reliever Don Aase. McGregor was deep in trouble in the first two innings, allowing three hits and leaving five runners on base. The Yankees left a runner on third in the first and left the bases loaded in the second before McGregor settled down and allowed only three more hits.

Weaver removed him after seven innings and brought in Aase, who pitched the final two innings for his 15th save and increased his AL lead over New York's Dave Righetti (who has 12).

Ripken's eighth homer gave the Orioles a 1-0 lead in the top of the first, but the Yankees came right back for a 1-1 tie in the last of the inning and had McGregor on the ropes.

Rickey Henderson got a leadoff walk and went to third when Don Mattingly grounded a single to right. Dave Winfield scored Henderson with a sacrifice fly to left.

Gary Roenicke lined to Alan Wiggins for the second out, but McGregor walked Dale Berra. With Brad Havens warming in the bullpen, he got out of the first inning, though, getting Willie Randolph on a flyout to right.

The Orioles came back for a 3-1 lead in the top of the second and only an awful mistake by third-base coach Cal Ripken Sr. kept it from being 4-1.

The inning started with Juan Beniquez's singled to right, and Rayford then doubled to left. On the hit, Beniquez rounded second and went to third.

At first, Ripken waved for him to stop at third just as Roenicke was picking up the ball in left. Then, inexplicably, he waved him home, and the relay throw from shortstop Mike Fischlin to catcher Butch Wynegar had Beniquez by six feet.

That became important because Shelby followed with his fourth homer of the season and his third in five games.

But, in the last of the second, the Yankees had McGregor on the ropes again, although they didn't score. Wynegar and Mike Pagliarulo singled to lead off the inning, and Fischlin bunted them to second and third.

Henderson flied to shallow left for the second out, but McGregor walked Mattingly to bring up Winfield with the bases loaded.

Weaver again got Havens up in the bullpen, but McGregor wiggled out of trouble, getting Winfield on a called third strike.

The Orioles ran their lead to 4-1 in the top of the third when Lee Lacy got a one-out walk, Ripken grounded a single to center and Eddie Murray scored Lacy with a sacrifice fly to center.

Both pitchers settled down after that. Guidry worked out of trouble in the fifth inning and was finally taken out after allowing two hits in the sixth.

But the Orioles didn't score again off him, and McGregor also settled down and allowed only a single in the next three innings.

Berra's first homer of the season closed it to 4-2 in the sixth.

The Orioles stretched their lead to 5-2 in the eighth when reliever Bob Tewksbury walked Mike Young with one out. Juan Bonilla then got a pinch double off off reliever Bob Shirley and, after Rayford popped out, Shelby scored Young with a fielder's choice grounder to third (Young scored before Pagliarulo tagged out Bonilla).

Reliever Nate Snell remained in Baltimore today to receive treatment on a badly bruised right foot. Snell suffered the injury when a line drive from Seattle's Ken Phelps struck him during the ninth inning Thursday. The Orioles hope Snell will be able to rejoin the team Sunday. Without him, Weaver has only eight pitchers and, if Snell can't pitch Sunday, the Orioles would bring up someone from Rochester . . .

According to news service reports, 14 sticks of dynamite were found last night in an abandoned car in a parking lot outside Yankee Stadium before the New York-Baltimore game, which was billed as the Silver Shield game, a benefit to raise funds for widows and orphans of slain police officers. Police department spokesman James Coleman said all the sticks were safely removed by police by 8:58 p.m. and that no evacuation of the stadium was necessary.

*Red Sox 3, Brewers 0: Roger Clemens improved the major league's best pitching record to 10-0 with a four-hitter, striking out eight to give Boston the victory in Milwaukee.

Wade Boggs drove in all three runs while extending his hitting streak to 13 games.

Clemens' 10th victory came in his 11th start of the season and was his fifth straight triumph since a no-decision at Oakland. It was his fourth complete game of the season, his first shutout and gave him 98 strikeouts to hold onto the AL lead in that category.

*White Sox 6, A's 4: In Chicago, Ozzie Guillen and Julio Cruz each drove in two runs and right-hander Rich Dotson pitched the White Sox to victory over Oakland.

Guillen had a double and two singles, and Cruz singled twice. The White Sox scored three runs in the fourth inning to break a 1-1 tie.

*Blue Jays 12, Tigers 2: Jesse Barfield hit a three-run homer in a four-run second inning to help Toronto win in Detroit and wrest fifth place in the AL East from the Tigers.

Doyle Alexander (4-2) allowed five hits in seven innings to win his third straight decision.

*Royals 6, Twins 1: In Kansas City, Mo., Charlie Leibrandt checked Minnesota on six hits and George Brett went four for four and drove in two runs to lead Kansas City to its eighth victory in nine games.

Leibrandt (6-3) retired the first 12 batters until Tom Brunansky led off the fifth with a single. After Tim Laudner walked, Kent Hrbek singled to score Brunansky with the Twins' only run.

*Indians 3, Angels 0: Ken Schrom outdueled Kirk McCaskill with a two-hitter, holding California hitless after the second inning, and the Indians snapped a three-game losing streak with the victory in Cleveland.