Cardinality of a minimal generating set is the cardinality of a basis Let $R$ be a commutative ring with unity. Let $M$ be a free (unital) $R$-module.
Define a basis of $M$ as a generating, linearly independent set.
Define the rank of $M$ as the cardinality of a basis of $M$ (as we know commutative rings have IBN, so this is well defined).
A minimal generating set is a generating set with cardinality $\inf\{\#S:S\subset M, M=\langle S \rangle\}$.
Must a minimal generating set  have cardinality the rank of $M$?
 A: Yes, a generating set of minimal cardinality  must have cardinality $r=rank_R(M)$.
It suffices to  show that for any generating set of $M$ with $s$ elements, we have  $s\geq r$  . 
Assume that $M=R^r$.
 Our generating set gives rise to   a  surjective $R$-module  morphism $R^s\to R^r\to 0 \quad (\star)$.
Let $\mathfrak m\subset R$ be a maximal ideal and tensor  $(\star)$ with the  field $k=R/\mathfrak m$ .
You get a $k$-linear map   $k^s\to  k^r  \to 0 \quad$ which is still surjective  by right-exactness of the tensor product.
Since $k$ is a field, this implies $s\geq r$.
Edit
Since Bruno just commented that he is also interested in the case of infinitely many generators, let me reassure him that the above reasoning remains true, with the obvious change from integers to cardinals and minor cosmetic adaptations in notation.
More precisely, we assume that $M=R^{(B)}$ where $B$ is a basis of $M$ of cardinality $card (B)=\beth$.
If $A$ is a generating set of $M$ of cardinality  $card(A)=\aleph $, we have a surjective morphism  $R^{(A )}\to R^{(B )} \to 0 \quad (\star)$ yielding once more  by tensorization (still right-exact!):
$k^{(A )}\to k^{(B )} \to 0 $  and the conclusion is again $\aleph \geq \beth$.
A: In Some remarks on the invariant basis property, Topology 5 (1966), pp. 215-228, MR 33  #5676, P.M. Cohn proved that there are rings in which the notion of rank is well defined, but which admit free modules of rank $t$ that can be generated by fewer than $t$ elements. However, he also proved that this is impossible if the ring is Noetherian, Artinian, or commutative. I don't have access to that paper, so I don't know how easy it is to prove, but in your situation (commutative rings), the answer is therefore "yes". 
A: The statement in the Edit of Georges's answer also holds in the non-commutative case:

Let $R$ be an associative ring with $1$. If $M$ is an $R$-module, if $B$ is an infinite basis of $M$, and if $S\subset M$ is a generating subset, then we have $$|S|\ge|B|,$$ where, for any set $X$, the symbol $|X|$ denotes the cardinality of $|X|$. 
In particular, if $C$ is another basis of $M$, then $|C|=|B|$. 

Proof: For any $x\in M$ let $B_x$ be the finite set of those $b$ in $B$ such that the $b$-component of $x$ is nonzero. The fact that $S$ generates $M$ implies 
$$ 
B=\bigcup_{s\in S}\ B_s, 
$$ 
and thus 
$$
|B|=\left|\ \bigcup_{s\in S}\ B_s\ \right|\ \le
\left|\ \coprod_{s\in S}\ B_s\ \right|=
\sum_{s\in S}\ \left|B_s\right|=|S|. 
$$ 
