In an epic duel that began today in the scorching midday sun and ended 5 hours 10 minutes later in the long, cool shadows of early evening, Vitas Gerulaitis defeated Guillermo Vilas, 6-7, 7-6, 6-7, 6-4, 6-2, to win the Italian Open tennis championship for the second time in three years.

Gerulaitis, 24, regained the second most important clay court title of Europe with remarkable stamina and perseverance, winning a splendid war in the red dust of Foro Italico between two of the strongest, quickest, fittest players in international tennis.

Gerulaitis kept battling relentlessly in the 90-degree heat of the white marble pressure cooker on the banks of the Tiber despite the disappointment of having led in each of the first three sets, only to lose two of then in tie breakers.

The flamboyant New Yorker, who is popular with the excitable and emotionally involved Italian spectators, must have been tempted to give up the torturous struggle when a 3-1 lead turned into a 3-4 deficit in the pivotal fourth set, but he kept attacking at every opportunity.

Following first serves to the net some of the time, scooting in behind chipped approach shots and aggressive returns of shots Vilas serves whenever he had the chance, Gerulaitis varied his attack smartly and refused to admit fatigue. He put a couple of strctches of fitful volleying out of his mind and seized nine of the last 11 games.

Vilas, 26, the muscular left-hander who was runner-up here in 1976 and won the French and U.S. opens on clay in 1977, continued to fight gallantly as well.

He swooped into the forecourt much more than he usually does on slow surfaces, made some memorable spinning volleys, but in the end was not Gerulaitis' equal at the net. When the zip and accuracy went out of his topspin passing shots in the last two sets, he did not have enough artillery in reserve.

At the finish, the crowd of 10,000 appreciative spectators erupted in applause for both players, creators of a marathon match that was rich in shotmaking, courage, and resolve.

The 17 statues that used to peer down with stony, stoic eyes on the activities in the center court are no longer a tangible part of matches here, their view totally blocked by iron stands recently built atop the marble foundation of one of tennis' most majestic arenas. But even they would have smiled at today's inspired goings-on.

This was the longest final ever in the Italian championships, which ranks second in prestige only to the French of the continent.

It was also thought to be the longest ever in terms of time, consuming 4 hours 53 minutes of actual play, plus a 17-minute intermission between the second and third sets.

For Gerulaitis, the noted playboy who celebrated his first victory here in 1977 by throwing a lavish party at Jackie O's discotheque on the Via Veneto, the title had value far beyond the $28,000 first prize check.

"This is the first tournament I ever won that really meant anything." said Gerulaitis, who used it as springboard to the Australian Open and World Championship Tennis titles over the ensuing 12 months.

"It's nice to come back here and win again, for sentimental reasons."

Gerulaitis spent the past three weeks training and practicing intensively with his coach, Australian Fred Stolle, an admitted taskmaster who demands fitness.

"He hasn't been out on the town past midnight for three weeks," said Stolle.

The first three sets were all excruciatingly close, in marked contrast to the only two previous career meetings between Geurlaitis and Vilas, both on clay, both of which Vilas had won in easy straight sets.

Gerulaitis lost his serve at love on a double-fault, the first of seven, in the first game, but broke back immediately in a 10-minute game that went to deuce twice. Thus, the twisting pattern of the contest was set at the outset.

Gerulaitis got 5-3, lost his serve at love again, and eventually lost the best-of-12-point tie breaker, 7-4, He dropped four of five points on his serve, the last two on crackling passsing shots by Vilas.

That set took 70 minutes. The second took 65, practically the only difference being that Gerulaitis, after playing a terrible game to lose his serve at 5-4, swept through the tie breaker, 7-0.

In the third set, Gerulaitis trailed, 1-3, won four games in a row, then was unable to serve out the set again.

Once more they went into a tie breaker, and Vilas won this one, 7-5, the most critical points being a lovely topspin lob winner by Vilas with Gerulaitis serving at 3-4, and an easy forehand volley that Gerulaitis pushed long on the final point.

Both players started slowly after showering and changing clothes between the third and fourth sets. Vilas lost his serve in the first game, fell behind, 1-3, but won 11 of 12 points to sprint to a 4-3 lead.

Gerulaitis was playing raggedly, holding on in desperation like a prize-fighter trying to clinch to prevent a knockout, but Vilas could not put him away. He thought the next three games were the turning point.

Gerulaitis suddenly rediscovered the touch on his volley and, buoyed by screams and whistles of encouragement from the enthralled crowd, reasserted his control of the net.

The match began at 2 p.m. - had this not been the first day of daylight saving time in Italy, it would never have been completed before nightfall - and as it went into its sixth hour, both players were still running flat out for astonishing gets, stroking winners on the dead run.

They both showed a momentary touch of what seemed like delayed sunstroke - Vilas losing his serve on the eighth of his 10 double faults in the third game of the final set, Gerulaitis giving the break right back on the fifth of his double faults in the next game.

Gerulaitis came out of the daze first, breaking Vilas again for a 3-2 lead. Vilas led 40-15 in this game, double-faulted to deuce, and then Gerulaitis seized control.

He got to advantage with a superb topspin lob winner, a shot Vilas had tortured him with earlier. Then he drove Vilas wide to his backhand corner with an approach shot and put away a crisp forehand volley down the line.

Gerulaitis squirmed out of three break points in the next game - a magnificent little match within the longest match - and after that, Vilas had nothing left. He kept hitting out, trying to make Geurlaitis crack, but Broadway Vitas was shining brighter than the lights of the Great White Way by now, and there would be no denying him. CAPTION: Picture, Vitas Gerulaitis concentrates in win over Guillermo Vilas. UPI