About 25 per cent of `hot Jupiters' (extrasolar Jovian-mass planets with close-in orbits) are actually orbiting counter to the spin direction of the star. Perturbations from a distant binary star companion can produce high inclinations, but cannot explain orbits that are retrograde with respect to the total angular momentum of the system. Such orbits in a stellar context can be produced through secular (that is, long term) perturbations in hierarchical triple-star systems. Here we report a similar analysis of planetary bodies, including both octupole-order effects and tidal friction, and find that we can produce hot Jupiters in orbits that are retrograde with respect to the total angular momentum. With distant stellar mass perturbers, such an outcome is not possible. With planetary perturbers, the inner orbit's angular momentum component parallel to the total angular momentum need not be constant. In fact, as we show here, it can even change sign, leading to a retrograde orbit. A brief excursion to very high eccentricity during the chaotic evolution of the inner orbit allows planet-star tidal interactions to rapidly circularize that orbit, decoupling the planets and forming a retrograde hot Jupiter.