Sparky Anderson was sitting on a five-run, ninth-inning lead over a semicomatose Orioles team tonight and he was worried.

"I'm not kidding you," said the white-haired Detroit manager after the Tigers had finally tucked away a 7-1 victory. "When you've lost 10 games in a row like we have, you don't feel safe until you're in the locker room.

"I didn't think anything else could happen to us. What concerned me is that we could come in here tonight and play a perfect game against Baltimore and still lose."

The Tigers played almost perfectly tonight. On a mild, clear night before 27,191 Memorial Stadium fans, they enjoyed fine pitching performances by rookie starter Jerry Ujdur and reliever Dave Tobik, picked up home runs from Larry Herndon (No. 14), Kirk Gibson (8) and Lou Whitaker (4) and were marching along with a 6-0 lead in the eighth inning when a scary thing happened.

With two outs and Eddie Murray on first base for the Orioles, Cal Ripken sent a hard grounder to third baseman Tom Brookens, who had moved to third from second as a late-inning defensive measure.

Brookens fielded the ball smoothly but threw it at least three feet over the head of tall first baseman Enos Cabell. It hit the box-seat fence on a fly, Ripken reaching and Murray racing to third on the error. Gary Roenicke followed with a clean single to left that scored Murray and set Anderson's peptic juices flowing.

He replaced Ujdur, who had allowed seven Oriole hits through 7 2/3 innings, with Tobik and went back to the dugout to stew.

Two days earlier against the Red Sox, he had watched Dwight Evans hit a two-run home run into the Fenway Park bleachers with two out in the ninth to wipe out a two-run Tiger lead. The Red Sox went on to win.

But tonight the bad luck ceased. Tobik retired Joe Nolan and preserved the victory. The Tigers even got the giveaway run back on Whitaker's bases-empty homer in the ninth, "and boy, I felt good about that," said Anderson with a sigh.

It was not a memorable night for Baltimore. Starting pitcher Scott McGregor was the victim of nine hits and six runs in 6 2/3 innings. It was his second straight mediocre performance (the Yankees had 11 hits off him in his last outing). McGregor's record fell to 8-5.

Baltimore fell behind, 3-0, in the second inning thanks to Herndon's homer and some shoddy fielding. Catcher Nolan bobbled a sacrifice bunt by Chet Lemon, putting runners at first and second. Both wound up scoring on a sacrifice fly and Alan Trammell's RBI single. Both runs were unearned.

It was all Detroit needed, although it added single runs in the fifth, sixth and seventh before McGregor gave way to reliever Ross Grimsley.

Meanwhile, Ujdur, who was called up from the Evansville AAA farm club 18 days ago and was making his fourth start, was mowing down the lackluster Orioles. Baltimore managed to get runners to second base only twice until the eighth inning.

The rookie right-hander upped his record to 1-2.

The Tigers were 16 games over .500 and a half-game out of first place when hard times struck June 13. After the 10 straight losses they had fallen back to third place, 5 1/2 games back. Anderson said he was trying to keep his players loose as they sought tonight to keep this from becoming their worst losing streak since 1975. He felt they were pressing and that contributed to the poor play.

"Everybody's trying to get the big hit, make the big play," he said before the game.

Cabell said that when he watched Brookens' throw sail over him it never occurred to him the roof was caving in again. "Sparky worries," he said. "That's his job. We just say, 'Oh, well. What's new?' "

Said Anderson, "I'm glad they were loose, 'cause I sure wasn't."