In the ultimatum game, two players are asked to split a certain sum of money. The proposer has to make an offer. If the responder accepts the offer, the money will be shared accordingly. If the responder rejects the offer, both players receive nothing. The rational solution is for the proposer to offer the smallest possible share, and for the responder to accept it. Human players, in contrast, usually prefer fair splits. In this paper, we use evolutionary game theory to analyse the ultimatum game. We first show that in a non–spatial setting, natural selection chooses the unfair, rational solution. In a spatial setting, however, much fairer outcomes evolve.