win (something) by a neck
To succeed or defeat someone in something by only a very narrow margin. Making huge gains during the final lap, the underdog rookie managed to overtake the reigning champion and win the race by a neck. We only won by a neck, but at least we got the conviction we were looking for.
win by a neck
succeed by a small margin.