Williams, who signed a one-year contract Jan. 7 after announcing in September that he was taking some time away from the NHL, skated in slowly before beating goalie Thomas Greiss five-hole.
"I was nervous the whole game, to be honest," Williams said.
"I assumed I would be on the 10-to-12 sheet if we got going a little further, but Hurricanes coach Rod Brind'Amour] tapped me a little earlier than I thought. [Greiss is] a very patient goalie, so I figured I would try and shoot it five-hole."
***[WATCH: [All Islanders vs. Hurricanes highlights]*
Andrei Svechnikov scored in regulation and in the shootout for the Hurricanes (28-18-3), who had lost three straight. James Reimer made 26 saves.
Greiss made 31 saves for the Islanders (28-15-5), who have lost three in a row and are 1-3-2 in their past six games.
"I thought the first five or six minutes we were on our heels, and then I thought we settled down and we were fine for the rest of the game," New York coach Barry Trotz said. "I didn't have any problem. We had some chances, and their goaltender had some good saves. That was a [Stanley Cup] Playoff-style game."
Svechnikov scored his 19th goal of the season at 5:45 of the first period to give the Hurricanes a 1-0 lead when his one-timer broke the stick of Islanders defenseman Noah Dobson and knuckled past Greiss.
Anders Lee tied it 1-1 at 19:04 of the second period. Reimer and Jaccob Slavin tried to clear the rebound after Scott Mayfield's shot was blocked in front, but Lee got to the puck and shot into an open net from the low slot.
"[Lee] was a horse tonight," Islanders forward Casey Cizikas said. "He was big down low. He's not an easy guy to contain. He led us tonight and he got us that big goal."
After Williams scored in the shootout, Reimer made the save against Lee to end the game.
"When [Williams] scored, you know you have to make that save," Reimer said. "You just try to be big and hold your ground and make a read at the end."