Although I guess it is possible to "win by a head," in the United States it is much more common to hear the phrase "win by a nose."
Literally, it refers to a horse race with a very close finish. In the official photo finish, two horses are side by side and it is only the winner's nose that is ahead of the runner-up. Here's an actual example from a news story:
"In Dubai, Thunder Snow became the first two-time winner of the $12-million Dubai World Cup when he held off a hard-charging Gronkowski to win by a nose at the Meydan Racecourse."
Figuratively, it means to win a contest by a very small amount.
In an election debate, a news story says "Neither man came off particularly well, but Mr Johnson, more experienced in the rough and tumble of debate than his opponent, won by a nose. A snap poll by YouGov gave him victory by 51%-49%, a gap within the margin of statistical error."
A story about a cooking contest says this:
"So, who took the cake? Pastry expert Alexander from New York, who was the frontrunner all along, or patient, composed Dara, from Culver City, Calif.? It was Alexander who won by a nose. Though though judges expressed concern that the curly-haired teen had bit off more than he could chew in 90 minutes, he wowed them as always with the finished product."
(The writer here is having fun by using two other idioms as well. "To take the cake" can mean "to win." "To bite off more than you can chew" means "to take on too big a task.")