Perturbative coefficients for Wilson loops and the static-quark self-energy are extracted from Monte Carlo simulations at weak coupling. The lattice volumes and couplings are chosen to ensure that the lattice momenta are all perturbative. Twisted boundary conditions are used to eliminate the effects of lattice zero modes and to suppress nonperturbative finite-volume effects due to Z(3) phases. Simulations of the Wilson gluon action are done with both periodic and twisted boundary conditions, and over a wide range of lattice volumes (from $3^4$ to $16^4$) and couplings (from $\beta \approx 9$ to $\beta \approx 60$). A high precision comparison is made between the simulation data and results from finite-volume lattice perturbation theory. The Monte Carlo results are shown to be in excellent agreement with perturbation theory through second order. New results for third-order coefficients for a number of Wilson loops and the static-quark self-energy are reported.