Come in a close second

To almost be chosen first for something.

The politician came in a close second in the election.