Abstract. We study, from a combinatorial viewpoint, the quantized coordinate ring of m × n matrices over an infinite field K, Oq(Mm,n(K)) (often simply called quantum matrices).The first part of this paper shows that Oq(Mm,n(K)), which is traditionally defined by generators and relations, can be seen as a subalgebra of a quantum torus by using paths in a certain directed graph. Roughly speaking, we view each generator of Oq(Mm,n(K)) as a sum over paths in the graph, each path being assigned an element of the quantum torus. The Oq(Mm,n(K)) relations then arise naturally by considering intersecting paths. This viewpoint is closely related to Cauchon's deleting derivations algorithm.The second part of this paper applies the above to the theory of torus-invariant prime ideals of Oq(Mm,n(K)). We prove a conjecture of Goodearl and Lenagan that all such prime ideals, when the quantum parameter q is a non-root of unity, have generating sets consisting of quantum minors. Previously, this result was known to hold only when char(K) = 0 and with q transcendental over Q. Our strategy is to prove the stronger result that the quantum minors in a given torus-invariant ideal form a Gröbner basis.