photo finish
US /ˈfoʊ.toʊ ˌfɪn.ɪʃ/
UK /ˈfoʊ.toʊ ˌfɪn.ɪʃ/

1.
a close finish of a race, especially one in which the winner is not immediately obvious and has to be determined from a photograph of the competitors as they cross the finishing line
:
•
It was a photo finish in the 100-meter dash, with only a millisecond separating the top two runners.
•
The horse race ended in a dramatic photo finish, keeping everyone on the edge of their seats.
2.
a situation in which the outcome is decided by a very small margin or at the very last moment
:
•
The election was a photo finish, with the winner declared only after all votes were counted.
•
The negotiation went down to a photo finish, with the deal being signed just minutes before the deadline.