Atomic structure and magnetic anisotropy of Ru/Co/Ru͑0001͒ were studied by Co K-edge extended x-ray absorption fine structure and Co L III,II -edge x-ray magnetic circular dichroism. The Co/Ru͑0001͒ films exhibit in-plane magnetization in a thickness range of 1-15 ML. The Co film shows a large expansion of the in-plane Co-Co bond length at the initial stage of the growth, leading to a large strain. Upon Ru capping on the Co/Ru͑0001͒ film, the strain is relaxed and a spin reorientation transition ͑SRT͒ occurs from in-plane to out-of-plane magnetization. These results contradict the conventional understanding of magnetic anisotropy in which perpendicular magnetic anisotropy ͑PMA͒ is believed to be enhanced by the strain in the film. The estimation of magnetic anisotropy constants revealed that the SRT is induced by a large PMA at the Co/Ru interface in the Ru capped films, as well as a large in-plane magnetic anisotropy at the vacuum/Co and/or Co/Ru interfaces in the Co bare films.