We study the existence of competitive equilibria in economies with indivisible goods. The first result provides a novel sufficient condition for an economy with indivisible goods to have competitive equilibrium. This condition states that the cooperative game associated with the economy has a non-empty core. Crucially, this sufficient condition is also necessary when the economy is convex. This characterization implies that every two-agent convex economy has at least one competitive equilibrium.