We present a stochastic quantum computing algorithm that can prepare any eigenvector of a quantum Hamiltonian within a selected energy interval $[E-epsilon, E+epsilon]$. In order to reduce the spectral weight of all other eigenvectors by a suppression factor $delta$, the required computational effort scales as $O[|log delta|/(p epsilon)]$, where $p$ is the squared overlap of the initial state with the target eigenvector. The method, which we call the rodeo algorithm, uses auxiliary qubits to control the time evolution of the Hamiltonian minus some tunable parameter $E$. With each auxiliary qubit measurement, the amplitudes of the eigenvectors are multiplied by a stochastic factor that depends on the proximity of their energy to $E$. In this manner, we converge to the target eigenvector with exponential accuracy in the number of measurements. In addition to preparing eigenvectors, the method can also compute the full spectrum of the Hamiltonian. We illustrate the performance with several examples. For energy eigenvalue determination with error $epsilon$, the computational scaling is $O[(log epsilon)^2/(p epsilon)]$. For eigenstate preparation, the computational scaling is $O(log Delta/p)$, where $Delta$ is the magnitude of the orthogonal component of the residual vector. The speed for eigenstate preparation is exponentially faster than that for phase estimation or adiabatic evolution.