"I think that this was important for us," Wright said. "I think it's important to not get complacent."
The Mets, who own a 9½-game lead in the NL East, haven't lost three straight all season. They are 18-8 in their last 26 games.
"Two games is not a long time. We've been crushing the ball for the last week and a half and every once in a while you're going to get a few days where you look like you're struggling," manager Willie Randolph said. "By no means were we struggling. But any time you hit a grand slam like that, with a big crowd, everybody gets rolling."
Reserve catcher Ramon Castro also homered and knocked in two runs for the Mets, who won the final eight games of a 9-1 road trip before dropping the first two in this series to Baltimore.
Substitute outfielder Eli Marrero also came through with an excellent all-around game, as did 47-year-old first baseman Julio Franco.
"It's phenomenal when you can plug in guys off our bench and we don't feel like we lose too much," Wright said.
Glavine (10-2) lasted six-plus innings, improving to 8-0 in his past 10 starts and earning his 285th career win. Detroit's Kenny Rogers also got his 10th victory and Boston's Curt Schilling went into his scheduled start with nine.
Wright hit his grand slam in the fifth off rookie Adam Loewen (0-2), who became the first pitcher to face a former Cy Young Award winner in each of his first four major league starts, according to the Elias Sports Bureau.
"It kind of fell apart a little bit late, but we did a great job taking two out of three from a great team," Baltimore manager Sam Perlozzo said.
The Mets took control for good in a wild seventh inning.
First, Marrero made a leaping catch in right field to preserve a 5-4 lead. Then, they scored four times in the bottom half against Baltimore's bullpen with some help from third baseman Melvin Mora and three Orioles errors.
Mora was playing in to defend against a bunt when Jose Reyes' liner nailed him on the left knee and ricocheted away for an infield single. Mora went down to the grass in pain, but remained in the game.
"I hit that one real good," Reyes said. "They have to be careful with me. They never know what I'm going to do."
Marrero sacrificed, and Mora threw high to first on Carlos Beltran's grounder for an error.
Wright hit an RBI single, and Franco followed with one of his own. Ed Rogers overthrew the plate for an error, and Wright scored all the way from first on an obstruction call. Third base umpire Doug Eddings ruled that shortstop Miguel Tejada blocked Wright as he rounded third and headed for home, where he was cut down.
"The umpire told me that the baserunner had actually made contact with Miguel, and without that the runner would have made home safely," Perlozzo said.
Franco caught Mora napping and stole third before Castro's two-out RBI single made it 9-4.
Mora came out in the eighth with a bruised left knee and is day to day.
"It is very sore," he said.
Tejada doubled leading off the second and scored on Corey Patterson's RBI grounder, putting Baltimore ahead.
Loewen retired his first two batters in the fifth, then ran into trouble. Reyes singled, and the lefty hit Marrero and Beltran with pitches, loading the bases.
Wright, who finished with three hits, drove the next delivery over the left-field fence for his third career slam and a 4-1 lead, chasing Loewen.
"The bases were loaded so I had to throw a strike. I thought I put it in a good spot, but I guess he was expecting it," Loewen said.
The Orioles cut it to 4-3 in the sixth on two-out RBI singles by Javy Lopez and Patterson, but Glavine struck out Rogers with runners at the corners.
Castro connected for an opposite-field solo shot in the bottom half against Chris Britton.
"I think that was my first home run to right field in the big leagues," Castro said.
Nick Markakis' leadoff double in the seventh ended Glavine's outing, and Brian Roberts' RBI groundout trimmed the lead to 5-4 before Chad Bradford got out of the inning.
Glavine allowed four runs and nine hits, striking out six and walking none.
- Orioles LF Luis Matos was ejected by plate umpire Paul Schrieber for arguing balls and strikes after he was called out looking in the fifth. Matos was replaced in left by Rogers.
- Franco probably saved a run with a leaping catch of Patterson's liner to first, ending the fourth inning.
- Marrero also made a pair of nice, running grabs in the first. He reached base safely three times and stole two bases.
- Loewen made his first major league start June 3 against Yankees lefty Randy Johnson, and his last two against Toronto ace Roy Halladay.
- Baltimore finished 4-6 on its road trip.