"It's a really important game for us, even though it's early in the year," said Rangers center J.T. Miller, who had an assist. "A character win is a good way to put it."
Pavel Buchnevich scored the deciding goal at PPG Paints Arena as New York halted the Penguins' four-game winning streak.
"There's no doubt that tonight's a big win against the Stanley Cup champions," Rangers coach Alain Vigneault said.
Buchnevich attempted a pass across the slot, but the puck hit the leg of Pittsburgh defenseman Kris Letang and sailed over the glove of Penguins goaltender Tristan Jarry at 11:12 of the third to break a 3-3 tie.
Letang called it simply "a bad bounce on our part," and Jarry felt about the same.
"It's tough," said Jarry, who made 25 saves but had his four-game winning streak end. He has been filling in for the injured Matt Murray.
"It's one of those unfortunate events that just goes off our own player. I tried to do my best just to get up as quick as I could and try and get over. It just went right past my head. I wasn't able to get over there."
Ondrej Pavelec, who was pegged to start in net when Henrik Lundqvist developed a flu-like illness, stopped 41 shots for the Rangers (15-10-2), who have won six of their past seven and 12 of 15.
"It was a good hockey game," said Pavelec, who withstood a good deal of pressure in the waning moments with an empty Pittsburgh net for his first win since Oct. 26. "Not so much fun for the goalies, but we got the win. That's huge for us."
The Penguins (15-11-3) took leads of 1-0 and 2-1 on goals by Conor Sheary and Phil Kessel, but New York answered fairly quickly both times with goals by rookie Boo Nieves and Jesper Fast before a goal by Mats Zuccarello late in the second gave the Rangers a 3-2 lead.
Pittsburgh's Patric Hornqvist forged another tie, 3-3, in the third.
Although New York dominated much of the first, including a 10-4 shot edge, the Penguins broke through first.
Sheary converted a big backhand shovel of a pass through a crowded slot from Hornqvist at 15:13 for a 1-0 Pittsburgh lead.
The Rangers tied it 1:36 later on Nieves' first NHL goal, a shot from the top of the right circle that made it through traffic and under Jarry's pads.
Vigneault noted that Pavelec "didn't have a lot of work in the first but did have quite a few shots after that. They're high-volume shots. They shoot from everywhere and hope to create scrambles. Against that you've got to protect the front of your net and we did that fairly well. He did give us a real strong game. I'm really happy for him. He's put in a lot of work and sure there's going to be a few more of those to come."
Kessel scored his team-leading 13th goal at 7:11 of the second for a 2-1 Penguins lead when he took a feed from Jake Guentzel and scored from the right circle.
New York tied it once more at 12:26 of the second on a Fast rebound goal.
The Rangers took their first lead, 3-2, at 17:20 of the second when Zuccarello moved in on Jarry and found a sliver of room inside the left post.
Pittsburgh went into the third trailing despite outshooting New York 23-8 in the second, and tied it 3-3 when Evgeni Malkin sprang Hornqvist for a breakaway on a power play. Hornqvist beat Pavelec to the glove side at 3:35.
That gave Hornqvist a four-game goal streak and a six-game point streak.
"This was a huge game for us," Hornqvist said. "All the division games are going to be key games, already right now.
"We know that's a tough loss, but our effort was there. We played a good hockey game. Sometimes you've got to tip the hat a little bit for the Rangers. They played hard. They got the puck luck."
NOTES: Pittsburgh D Justin Schultz limped off late in the first, returned for the second but did not come out for the third. Coach Mike Sullivan said Schultz has a lower-body injury and will be evaluated Wednesday. ... The Rangers recalled G Alexandar Georgiev, who backed up G Ondrej Pavelec with G Henrik Lundqvist ill. ... New York RW Michael Grabner played in his 500th NHL game. ... Pittsburgh G Matt Murray, who missed his third straight game because of a lower-body injury, has resumed skating without gear. ... In the annual Forbes Magazine financial ranking of NHL clubs, the Rangers are No. 1 with a value of $1.5 billion, up 14 percent, while the Penguins are No. 10 with a value of $650 million, up 20 percent.