The oxygen-deficient ͑double͒ perovskite YBaMn 2 O 5 , containing corner-linked MnO 5 square pyramids, is found to exhibit ferrimagnetic ordering in its ground state. In the present work we report generalized-gradientcorrected, relativistic first-principles full-potential density-functional calculations performed on YBaMn 2 O 5 in the paramagnetic, ferromagnetic, and ferrimagnetic states. The charge, orbital, and spin orderings are explained with site-, spin-, angular-momentum-, and orbital-projected density of states, charge-density plots, electronic structure, and total energy studies. YBaMn 2 O 5 is found to stabilize in a G-type ferrimagnetic state in accordance with experimental results. The experimentally observed semiconducting behavior appears only when we include ferrimagnetic ordering in our calculation. We observed significant optical anisotropy in this material originating from the combined effect of ferrimagnetic ordering and crystal-field splitting. In order to gain knowledge about the presence of different valence states for Mn in YBaMn 2 O 5 we have calculated K-edge x-ray absorption near-edge spectra for the Mn and O atoms. The presence of the different valence states for Mn is clearly established from the x-ray absorption near-edge spectra, hyperfine field parameters, and the magnetic properties study. Among the experimentally proposed structures, the recently reported description based on P4/nmm is found to represent the stable structure.