This paper presents a simple method of calculating one-sided p-values which yield accurate inferences for a simple null hypothesis or, equivalently, accurate one-sided confidence limits regarding a scalar parameter in the presence of nuisance parameters. The method, which extends the work of DiCiccio et al. (2001) and Lee & Young (2005) in the context of adjusted likelihood estimation, is based on a test statistic analogous to the signed root of the loglikelihood, but derived from the objective function of an M-estimator from a certain class. Monte Carlo simulation is used to avoid the need for onerous analytical calculations typical of competing procedures based on Edgeworth or saddle-point approximations. The specific class of M-estimators under consideration is characterised by the requirement that the associated test statistic has constant variance to second order. This class contains, among others, the maximum likelihood estimator as well as variants of commonly used M-estimators of location, such as Huber's (1964) Proposal 2.