We present a determination of the real-space galaxy correlation function, xi(r), for galaxies in the APM Survey with 17 less than or equal to b(J) less than or equal to 20. We have followed two separate approaches, based upon a numerical inversion of Limber's equation. For Omega=1 and clustering that is fixed in comoving coordinates, the correlation function on scales r less than or equal to 4 h(-1) Mpc is well fitted by a power law xi(r)=(r/4.5)(-1.7). There is a shoulder in xi(r) at 4 less than or equal to r less than or equal to 25 h(-1) Mpc, with the correlation function rising above the quoted power law, before falling and becoming consistent with zero on scales r greater than or equal to 40 h(-1) Mpc. The shape of the correlation function is unchanged if we assume that clustering evolves according to linear perturbation theory; the amplitude of xi(r) increases, however, with r(0)=5.25 h(-1) Mpc. We compare our results against an estimate of the real-space xi(r) made by Loveday et al. from the Stromlo-APM Survey, obtained using a cross-correlation technique. We examine the scaling with depth of xi(r), in order to make a comparison with the shallower Stromlo-APM Survey and find that the changes in xi(r) are within the 1 sigma errors. The estimate of xi(r) that we obtain is smooth on large scales, allowing us to estimate the distortion in the redshift-space correlation function of the Stromlo-APM Survey caused by galaxy peculiar velocities on scales where linear perturbation theory is only approximately correct. We find that beta=Omega(0.6)/b=0.61 with the 1 sigma spread 0.38 less than or equal to beta less than or equal to 0.81, for Omega=1 and clustering that is fixed in comoving coordinates; b is the bias factor between fluctuations in the density and the light. For clustering that evolves according to linear perturbation theory, we recover beta=0.20 with 1 sigma range - 0.02 less than or equal to beta less than or equal to 0.39. We rule out beta=1 at the 2 sigma level. This implies that if Omega=1, the bias parameter must have a value b>1 on large scales, which disagrees with the higher order moments of counts measured in the APM Survey (Gaztanaga).