An adaptive control algorithm for spacecraft rendezvous and docking in a Keplerian orbit is presented. The equations of relative motion of two spacecrafts expressed in a local-vertical-local-horizontal rectangular frame are converted to a general Hamiltonian form, then an adaptive control method developed for the uncertain Hamiltonian system is applied to the rendezvous and docking problem. A smooth projection algorithm is applied to keep the parameter estimates inside a singularity-free region, and a numerical example shows that the developed controller successfully deals with the unknown mass of the chaser spacecraft.