NEW YORK -- Greg Maddux struggled all night. Still, he ended his six-game losing streak, and that was good enough for him.
Maddux (8-11) allowed seven runs and 10 hits in six-plus innings, but still managed to tie Eddie Plank for 12th on the career wins list with 326. The right-hander won for the first time in eight starts since beating Cincinnati on June 9.
"Hey, you feel good you won and you feel (bad) you gave up seven runs," said Maddux, who briefly consulted with a trainer about a blister on his right foot but insisted he was fine afterward.
"You'd rather win than pitch good and lose," he said. "They've got a good lineup. There's nothing wrong with me. They hit me, we just hit them a little better."
Maddux's 35th career victory against the Mets, his most against any opponent and the most for any pitcher against New York, came against Steve Trachsel, who had won a career-best seven straight decisions.
The Mets scored three runs in the seventh to pull within one. They had runners on first and second when Cubs shortstop Ronny Cedeno knocked down Cliff Floyd's grounder and threw him out to end the inning.
"The bullpen was very good," said Cubs manager Dusty Baker, whose team was swept by the Nationals before coming to Shea Stadium. "They were spent after this past weekend. I'm really proud of the way they came in and got the outs."
Nevin was subbing for first baseman Derrek Lee, who went back on the 15-day disabled list with inflammation in his right wrist.
The Cubs trailed 4-3 before Ramirez hit a 1-1 pitch from Trachsel (9-5) into the second deck in left for a two-run homer in the fifth. Ramirez's 22nd homer traveled an estimated 425 feet and came after Barrett's leadoff single.
"That was a huge inning for us," Barrett said. "We needed that."
Jones followed with a drive to center for his 16th homer. It was the second time in five days that the Cubs hit homers in consecutive at-bats. Barrett and Ramirez went deep against the Astros on Thursday, the first time Chicago hit back-to-back homers all season.
"I was in the strike zone but I was wild in the strike zone," Trachsel said. "A couple of times I had to execute pitches, I didn't do it."
Juan Pierre added a two-run single off Heath Bell to make it 8-4. Trachsel allowed a season-high eight runs and 10 hits in 4 2/3 innings, losing for the first time since a 1-0 defeat May 17 at St. Louis.
"His command was off and when you have to throw it over the plate it can be trouble. A couple of big home runs," Mets manager Willie Randolph said. "He kept getting behind and you can't do that."
Carlos Delgado drove in two runs for the Mets. Carlos Beltran's sacrifice fly in the seventh gave him 80 RBI, a club record for center fielders.
- Maddux is 35-18 in 64 starts against the Mets. He is 14-11 in 30 starts at Shea Stadium.
- INF Ryan Theriot was recalled from Triple-A Iowa to take Lee's roster spot. Lee, a two-time Gold Glove winner and the 2005 NL batting champion, broke two bones in his wrist in April. He was activated from the DL on June 25 but has experienced some pain and weakness in the wrist since his return.
- Mets RHP Pedro Martinez (sore hip) is expected to return to the rotation Friday in Atlanta, and Randolph said the team will go to a six-man rotation for now.
- Baker said RHP Carlos Marmol should be OK for his next start. Marmol bruised his right hand while hitting in the third inning of Sunday's 7-1 loss to Washington.
- The attendance of 45,631 pushed the Mets over the 2 million mark for the season.