In this article, I discuss Leibniz's interpretation of the cosmological argument for the existence of God. In particular, I consider whether Leibniz's position on this point was developed partly in reference to Spinoza's position. First, I analyze Leibniz's annotations from 1676 on Spinoza's Letter 12. The traditional cosmological argument, as found in Avicenna and Saint Thomas for example, relies on the Aristotelian assumption that an actual infinite is impossible and on the idea that there can be no effect without a cause. From these premises, the argument concludes that God must be the uncaused first cause of all things. In Letter 12, Spinoza follows Chasdai Crescas and rejects this proof. Instead, he develops a variant of the cosmological argument which depicts God as the self-caused ground of all causes or things. In his annotations, Leibniz agrees with Spinoza about the inadequacy of the traditional argument, but remains ambiguous as to Spinoza's conception of God as a self-caused being. Next, I turn to Leibniz's comments from 1678 on Spinoza's Ethics. Here, Leibniz develops an original interpretation of the cosmological argument based entirely on the consideration of conceptual relations. Leibniz's argument depicts God as an uncaused being conceived through itself which is the condition of conceivability of all things. I argue that Leibniz developed this argument in deliberate opposition to Spinoza's conception of God as the self-caused ground of all causes or things.