The 35-year-old finished with an unbeaten 130-ball 102 to steer Pakistan to the modest target of 217 in 43.4 overs, carrying his batting form from the preceding 2-0 Test series win last week into the limited-overs clash.
Hafeez added 106 for the unbroken fifth wicket stand with Babar Azam (62 not out) and 70 for the fourth wicket with Shoaib Malik (26).
Eoin Morgan and James Taylor hit half centuries for England in a below-par total of 216 all out in 49.4 overs.
Younis, who before the start of the match announced his retirement from one-day cricket, finished his career with 7,249 runs in 265 matches.
Also Read
Hafeez and Malik steadied Pakistan to 111 before Malik fell to a reckless shot off spinner Moeen Ali.
Malik, when ten, completed 6,000 one-day runs in his 229th match. He is the ninth Pakistani batsman to score 6,000 or more one-day runs.
Hafeez, who hit 151 in the third Test in Sharjah last week, completed his tenth one-day century off 127 balls. He hit ten boundaries and a six.
Hafeez dedicated his hundred to the retiring Younis.
"I want to dedicate this hundred to Younis who has been a role model for all of us," said Hafeez of the senior batsman. "We want to win it for him and I am happy to have contributed in this win."
England skipper Morgan said his side's batting had let them down.
"We were quite a few runs short and with less than 220 on the board, you can't blame the bowlers, so there is a lot to learn and pick before the next game," said Morgan.
Morgan top-scored with 76 while Taylor made 60 as the pair added 133 for the fourth wicket as the only highlight of the innings.