Blockchains address this problem in two ways. First, they enforce a complete ordering on all transactions, which generates a tree of alternative views of history. Second, they define canon for histories, along with a fork-choice rule that selects the canonical branch from the tree of histories.
Blockchains solve the double spending problem in two ways.
(1) They enforce a complete ordering of all transactions, which results in a tree of possible histories. (2) They define a fork-choice rule that selects the canonical branch from the tree of all possible histories.