American Andrew Talansky prevails in a duel with overall leader Rafal Majka to claim a "famous win" on Stage 5 of the Tour of California.