The number of animals in a population is conventionally estimated by capture–recapture without modelling the spatial relationships between animals and detectors. Problems arise with non-spatial estimators when individuals differ in their exposure to traps or the target population is poorly defined. Spatially explicit capture–recapture (SECR) methods devised recently to estimate population density largely avoid these problems. Some applications require estimates of population size rather than density, and population size in a defined area may be obtained as a derived parameter from SECR models. While this use of SECR has potential benefits over conventional capture–recapture, including reduced bias, it is unfamiliar to field biologists and no study has examined the precision and robustness of the estimates. We used simulation to compare the performance of SECR and conventional estimators of population size with respect to bias and confidence interval coverage for several spatial scenarios. Three possible estimators for the sampling variance of realised population size all performed well. The precision of SECR estimates was nearly the same as that of the null-model conventional population estimator. SECR estimates of population size were nearly unbiased (relative bias 0–10%) in all scenarios, including surveys in randomly generated patchy landscapes. Confidence interval coverage was near the nominal level. We used SECR to estimate the population of a species of skink Oligosoma infrapunctatum from pitfall trapping. The estimated number in the area bounded by the outermost traps differed little between a homogeneous density model and models with a quadratic trend in density or a habitat effect on density, despite evidence that the latter models fitted better. Extrapolation of trend models to a larger plot may be misleading. To avoid extrapolation, a large region of interest should be sampled throughout, either with one continuous trapping grid or with clusters of traps dispersed widely according to a probability-based and spatially representative sampling design.