Consider a spanning tree $E$ and label its edges $e_1$, $\ldots$,$e_n$. Consider now a spanning tree $F$. Then there exists a labeling of the edges of $F$ $\ $ $f_1$, $\ldots$, $f_n$ so that the following are still spanning trees (use an exchange lemma like for two bases of a vector space):
$$(e_1, e_2, \ldots, e_{n-1},e_n) \\
(e_1, e_2, \ldots, e_{n-1},f_n)\\
(e_1, e_2, \ldots, f_{n-1}, f_n)\\
\ldots \\
(e_1, f_2, \ldots, f_{n-1}, f_n)\\
(f_1, f_2, \ldots, f_{n-1}, f_n)$$
Assume now that $E$ is obtained using the greedy algorithm:
$e_1$ is of minimal weight, $e_2$ is of minimal weight so that $e_1$, $e_2$ form no cycles, $e_3$ is of minimal weight so that
$e_1$, $e_2$, $e_3$ form no cycles, and so on, up to $e_n$. From the above we conclude that $w(e_i) \le w(f_i)$ for all $i$.
Since $F$ is arbitrary we conclude that $E$ is a minimal tree.
Now assume that $F$ itself is not a minimal tree. Then for some $i$ we have a strict inequality $w(e_i) < w(f_i)$.
Let $i$ the smallest index for which this happens. Let's assume now that all the edges have different weights. Then
we have $e_1= f_1$, $\ldots$,$e_{i-1} =f_{i-1}$. Hence the tree $(e_1, \ldots, e_{i-1}, f_{i}, \ldots, f_n)$ is $F$ and
the tree $(e_1, \ldots, e_{i-1}, e_i, f_{i+1}, \ldots, f_n)$ is obtained from it by exchanging the edge $e_i$ with an edge of
larger weight $f_i$.