We introduce a q-weighted version of the Robinson-Schensted (column insertion) algorithm which is closely connected to q-Whittaker functions (or Macdonald polynomials with t = 0) and reduces to the usual Robinson-Schensted algorithm when q = 0. The q-insertion algorithm is 'randomised', or 'quantum', in the sense that when inserting a positive integer into a tableau, the output is a distribution of weights on a particular set of tableaux which includes the output which would have been obtained via the usual column insertion algorithm. There is also a notion of recording tableau in this setting. We show that the distribution of weights of the pair of tableaux obtained when one applies the q-insertion algorithm to a random word or permutation takes a particularly simple form and is closely related to q-Whittaker functions. In the case 0 ≤ q < 1, the q-insertion algorithm applied to a random word also provides a new framework for solving the q-TASEP interacting particle system introduced (in the language of q-bosons) by Sasamoto and Wadati [SW98] and yields formulas which are equivalent to some of those recently obtained by Borodin and Corwin [BC11] via a stochastic evolution on discrete Gelfand-Tsetlin patterns (or semistandard tableaux) which is coupled to the q-TASEP process. We show that the sequence of P -tableaux obtained when one applies the q-insertion algorithm to a random word defines another, quite different, evolution on semistandard tableaux which is also coupled to the q-TASEP process.