A method for producing a straw mat in a living space for livestock, in particular for sows and/or fattening pigs and/or piglets, confined in a straw pen, is disclosed. The method comprises the step of automatically and initially spreading straw, such as defibrated straw, into the living space up to a substantially uniform thickness (d) of the straw mat. Also disclosed is a straw pen and pen building in accordance with the disclosed method.