What you are describing is called Instant Runoff Election, or Preferential voting.

The way it works, is you rank your choices in order, 1st, 2nd,3rd,... That way you vote first for the candidate whose views you most support, second for your alternative preference, and etc.

If your first vote were, for instance, for a third party that winds up with a small percentage of total votes in your state then that vote is skipped and your second choice is counted instead and etc. etc. down the line.

Here's a Wikipedia link on preferential voting:

Preferential voting - Wikipedia, the free encyclopedia

Instituting a ranked vote system in our elections would make an enormous difference in our democratic process: it would make third parties viable by creating a complete meritocracy of ideas, and it would force the main parties to discuss and debate third party ideas.