In a reasonable script for a big tennis upset, the clear underdog is cast as a former youth prodigy who had faded from the spotlight. He is given a costume that, frankly, is whatever a sportswear giant is featuring on its pros, for marketing purposes, at the U.S. Open (tennis-yellow, with little black splashes that appear to be bugs on a windshield.) He is matched against the recent Wimbledon runner-up, to set about pressuring that overwhelming favorite into a case of nervous stress that leads to debilitating cramps.

Ryan Harrison took the part.

So it is Harrison, carrying a thoroughly modest world ranking of 120, who moved into the Open’s third round, instead of No. 6 Milos Raonic. Resilient after double-faulting on set point to give Raonic the first set, Harrison stayed the course yesterday for a 6-7 (4), 7-5, 7-5, 6-1 victory.

It was a matter, Harrison said, of focusing on not letting an early deficit become “the tipping point.” It was a function of Harrison’s persistent — and sometimes dazzling — shot-making that began to render the big-serving Raonic immobile.

“Cramping,” Raonic said. “Halfway through the second set. I don’t think hydration was the issue. Probably just nerves and stress, a mental sort of overexuberance and it just caught up to me.

“I didn’t create this pressure for myself. He did that.”

Four years ago, as a 20-year-old, Louisiana native Harrison was leaping up the rankings ladder to No. 43, one of the future hopes for American men’s tennis. At the time, Canada’s Raonic, a year and a half older than Harrison, already had cracked the top 15.

advertisement | advertise on newsday

Raonic kept rising while Harrison, who played his first of 19 major tournaments in 2010 but never has advanced past the second round, went the other way.

Like his younger brother Christian, who finally recovered from a series of operations before losing his first-round match here, Ryan Harrison had to earn his way into this Open through its qualifying tournament.

He has learned, he said, that “whenever you are dealing with something for the first time, any new kind of emotional situation, everything feels like it’s a really big high or a really big low.”

Maturity has kicked in, he said. Family advice. (His father has run tennis centers throughout Ryan’s life.) So yesterday, he shook off that crucial early double fault, lived through the failure to convert six set points in the eighth game of the second set and, as Raonic began to seize up with cramps — “left arm, right forearm, both quads, a little bit of hip flexor,” Raonic said — Harrison kept charging.

He joins two other Yanks in the men’s third round. No. 20 seed John Isner defeated Belgium’s Steve Darcis, ranked 106th, in four sets, and No. 26 Jack Sock won in straight sets against 127th-ranked Mischa Zverev of Germany. No surprises in those scripts.

@NewsdaySports

Nadal wins under roof: The new roof over Arthur Ashe Stadium was closed for the first time, with light rain forcing closure during Rafael Nadal’s 6-0, 7-5, 6-1 win over Andreas Seppi.

Rain started to fall at 3-3 in the second set, forcing a slight delay in play while the roof, completed for 2016, was closed. Play was suspended at 10:38 p.m. and resumed at 10:46 p.m.