At high bitrates (0.65-0.80 bits per pixel) the two codecs produce similar results. However, MPEG-2 (H.262) is older; H.264 includes newer compression technologies designed to retain better visual quality at low bitrates whereas MPEG-2 deteriorates more quickly. For example, YouTube H.264 videos are typically encoded at about 0.07 bpp.
There are other considerations, also. H.264 is ubiquitous and therefore videos can be shared more easily. In addition, the H.264 licensing terms allow free distribution of videos 12 minutes or shorter, but MPEG-2 requires a royalty fee.
At this point in time MPEG-2 is used primarily for DVDs; otherwise, H.264 is the more common choice.