See Descartes' metaphysics :
According to Descartes' ontology there are three levels of being: substance, attribute, and mode. The levels of being are understood in terms of ontological dependence. Modes depend on attributes for their being in a way that attributes do not depend on modes. And, attributes depend on substances for their being in a way that substances do not depend on attributes.
The essence or nature of a mind, Descartes says, is to think. If a thing does not think, it is not a mind. In terms of his ontology, the mind is a (finite) substance, and thought or thinking is its attribute. Insofar as the essence or nature of a mind is to think, where thought is the mind's defining feature, Descartes calls it the mind's principal attribute. An idea is a mode of thought.
In the same way, extension is an attribute of the substance matter, and shape is a mode of extension.
In a nutshell, substances (two for Descartes; one for Spinoza) have attributes, some of which are the "fundamental" ones: thinking is the essence of mind.
Modes are the "ways" (modes) in which an attribute can manifest itself and the way we conceive them.
See Ethics, II :
Def I. By body I mean a mode which expresses in a certain determinate manner the essence of God, in so far as he is considered as an extended thing.
And
Ax.II. Man thinks.
Ax.III. Modes of thinking, such as love, desire, or any other of the passions [...]