Apple briefly surpassed $5 trillion in market value, becoming only the second company after Nvidia to reach the historic milestone.