You are talking about one of the segments from Creepshow 2, I believe.
Stealing from Wikipedia:
Four college students, Deke, Laverne, Randy, and Rachel decide to go swimming in a desolate lake far away from civilization. As they make their way to a wooden raft in the middle of the lake, they realize that they are being terrorized by a floating black blob resembling an oil slick when it grabs a hold of Rachel and consumes her.
The frightened students begin to panic. Deke plans to swim to shore so he can bring back help as he is a fast swimmer. But before he can carry out his plan, the blob seeps through the raft's cracks and pulls Deke through the raft, killing him in the process. Randy and Laverne manage to evade the creature long enough to where it gives up trying to grab them from under the raft as well.
Randy and Laverne spend the entire night on the raft, afraid to fall asleep in fear that the creature will attack. They do manage to fall asleep and Randy is the first to wake up in the morning, relieved to find that Laverne and himself made it through the night. With Laverne still sleeping, he begins caressing her body and fondling her breasts. She awakes screaming in agony as the creature has seeped through the cracks and has a hold of her face, much to Randy's horror.
As the oil-like blob pulls her off the raft and begins consuming her, Randy uses the opportunity to jump off the raft and swim to shore. He ultimately makes it, barely escaping the creature and yells "I beat you!" However, the oil creature rises up from the water like a wave and engulfs Randy. The blob returns to the lake, with no evidence of the four students even visiting the lake other than their car which was left running the whole time. The camera pans out to reveal a "No Swimming" sign barely visible from behind some growth.