The aim of the present work was to investigate the effect of anodization on the fatigue and corrosion-fatigue behavior of the AZ31B magnesium alloy. Samples were anodized in constant current density mode at 20 mA cm−2 for 5 min at room temperature, in an environmentally friendly electrolyte consisting of a mixture of sodium hydroxide and sodium silicate. Fatigue tests were conducted in air and in phosphate buffer solution (PBS) at room temperature in the tension-tension mode, at a frequency of 5 Hz and stress ratio of 0.1. S-N curves were obtained for polished and anodized samples. Fracture surface morphology was examined by optical stereo-microscopy and scanning electron microscopy. Results indicated that the fatigue limit was reduced approximately 60% at 106 cycles for the anodized specimens, either for the fatigue tests conducted in air or PBS solution. Anodization had a remarkable effect on the fatigue behavior of the AZ31B alloy. The effect of the corrosive environment, in turn, was not significant.