We give an effective version of a result reported by Serre asserting that the images of the Galois representations attached to an abelian surface with $\End(A)= \mathbb{Z}$ are as large as possible for almost every prime. Our algorithm depends on the truth of Serre's conjecture for two-dimensional odd irreducible Galois representations. Assuming this conjecture, we determine the finite set of primes with exceptional image. We also give infinite sets of primes for which we can prove (unconditionally) that the images of the corresponding Galois representations are large. We apply the results to a few examples of abelian surfaces.