LAS VEGAS — Late Saturday night, Miguel Cotto did to Floyd Mayweather Jr. what opponents rarely, if ever, do to Floyd Mayweather Jr. Cotto made him bleed.

It started when Cotto landed a quick, direct left hand square on Mayweather’s nose. Blood trickled down his chin and announced to the crowd at the Grand Garden Arena that Mayweather, the self-proclaimed best boxer in history, had himself a fight.

More telling was what happened next. As Mayweather wiped the blood with a red glove, he turned to Cotto and actually smiled. Like a vampire, re-energized, ready to go to work, in this case at the MGM Grand in front of another sold-out crowd pleading for Cotto to hand Mayweather his first defeat.

Cotto gave Mayweather a fight beyond expectation, a close fight, a tough fight, an instant classic. In the end, it was not enough. Mayweather triumphed in a unanimous decision and blew kisses to the crowd, which, naturally, booed him.

“You’re the toughest guy I ever fought,” Mayweather said to Cotto.

In victory, Mayweather added to his copious belt collection the W.B.A. super welterweight belt and the vacant W.B.C. one. On this night, it seemed as if the fight that happened was more interesting than the one that did not. On this night, it did not matter if Mayweather was not fighting Manny Pacquiao.

On this night, Cotto did some damage. The more Cotto landed right hooks to the body, the more he pinned Mayweather in corners, the more the crowd rose and cheered him on. The more they cheered for him, the more Mayweather shook his head.

By the ninth round, it was fair to consider whether Cotto could, you know, actually win, whether he could knock Mayweather from the ranks of the undefeated. Before the round, when Mayweather’s picture flashed across the big screen, his lip busted, his face bloody, the crowd erupted in applause.

As the bell for the 12th round sounded, the bout was too close for an obvious call. Again, Cotto pinned Mayweather in the corner. Again, they traded blows. With two minutes left, the crowd stood on its feet, chanting Cotto’s name. Mayweather landed one combination, then another. When the final bell sounded, the fighters hugged.

Cotto (37-3) had come close. But Mayweather (43-0) had done enough. On Saturday, Mayweather did what Mayweather does best. He put on a show, the usual mixture of sports and entertainment, another series of moments best summarized with “only Mayweather.”

If the lights that flashed and the crowd that booed served as a distraction, the din would fade by Sunday morning. Once the fight finished, another date of utmost importance loomed large. On June 1 Mayweather is scheduled to report to prison for misdemeanor domestic violence and harassment charges reached in a plea bargain.

For Mayweather, the superstar with the 18-room mansion, a 10-by-6-foot cell awaited.

Mayweather sauntered into the ring flanked by Justin Bieber and 50 Cent, with celebrities as divergent as Sean Combs and Triple H in the stands. Because he is Mayweather, he wore what looked like red leather shorts.

Early on, it appeared Cotto wanted to force the action, to steer Mayweather, the most brilliant technical boxer of his generation, toward a brawl. Cotto was the aggressor, even if he wore pink socks. In the second round, he lifted Mayweather off the canvas in a bear hug.

At the very least, Cotto made Mayweather look uncomfortable, forced him to fight in tight quarters and bounce around the ring. Mayweather spent much of the early rounds with his back against the ropes.

In the fourth, Mayweather landed a series of stinging right hands. The first snapped Cotto’s head back. So did the fourth, and the fifth, until it was as if Mayweather controlled Cotto’s head like a puppet master, snapping it back and forth.

But Cotto remained patient. He stalked Mayweather into corners, kept aiming for the body, both hands pummeling Mayweather’s ribs. After one furious exchange in the fifth round, Mayweather emerged from the corner and shook his head, as if to say that did not hurt.

Mayweather entered the Cotto fight as a heavy favorite, the odds as tilted as high as 7 to 1 early in the week. His favored status ended there, though. The crowd at the weigh-in showered him with boos, as did the crowd assembled at Grand Garden Arena.

Not that Mayweather showed an ounce of concern about the growing villain status he has helped to perpetuate. “We want to see the Floyd Mayweather with the flashy money,” he said earlier in training. “We want to see Floyd Mayweather with a diamond necklace. We want to see Floyd Mayweather with the nice cars.”

Mayweather essentially paid himself $32 million guaranteed for the fight, a record for the sport certain to increase when other revenue streams come in. At the weigh-in, the fighters conducted the usual staring contest as if attempting a world record. It lasted for maybe 20 seconds, which seemed like 20 minutes, with Mayweather furiously chewing gum less than an inch from Cotto’s face.

On the surface, Cotto provided respectable opposition. His two losses came against Antonio Margarito, who was later caught with hardened hand wraps, and to Manny Pacquiao, who fought — and decimated — Cotto. In his last fight, Cotto avenged his loss to Margarito.

Cotto, no less an authority than Oscar De La Hoya said, “should be undefeated.”

Mayweather fought Cotto at super welterweight, only Mayweather’s second venture into that division. Cotto weighed in at 154 pounds, the maximum.