We report the use of optimal control algorithms for tailoring effective Hamiltonians in nuclear magnetic resonance spectroscopy through sophisticated radio-frequency pulse irradiation.