The median of five is sometimes used as an exercise in algorithm design and is known to be computable using only 6 comparisons.
What is the best way
For completeness, the question is a specific case of a sorting network, which Knuth (Art of Computer Programming, vol 3) covers in great detail. The classic paper by K.E. Batcher on the subject is brief and worth reading.