The mechanism by which sunspots are generated at the surface of the sun remains unclear. In the current literature two types of explanations can be found. The first one is related to the buoyant emergence of toroidal magnetic fields generated at the tachocline. The second one states that active regions are formed, from initially diffused magnetic flux, by MHD instabilities that develop in the near-surface layers of the Sun. Using the anelastic MHD code EULAG we address the problem of sunspot formation by performing implicit large-eddy simulations of stratified magneto-convection in a domain that resembles the near-surface layers of the Sun. The development of magnetic structures is explored as well as their effect on the convection dynamics. By applying a homogeneous magnetic field over an initially stationary hydrodynamic convective state, we investigate the formation of self-organized magnetic structures in the range of the initial magnetic field strength, 0.01 < B 0/B eq < 0.5, where B eq is the characteristic equipartition field strength.