We present the results of a third order calculation of the pion-nucleon scattering amplitude in a chiral effective field theory with pions, nucleons and delta resonances as explicit degrees of freedom. We work in a manifestly Lorentz invariant formulation of baryon chiral perturbation theory using dimensional regularization and the extended on-mass-shell renormalization scheme. In the delta resonance sector, the on mass-shell renormalization is realized as a complex-mass scheme. By fitting the low-energy constants of the effective Lagrangian to the S-and P -partial waves a satisfactory description of the phase shifts from the analysis of the Roy-Steiner equations is obtained. We predict the phase shifts for the D and F waves and compare them with the results of the analysis of the George Washington University group. The threshold parameters are calculated both in the delta-less and delta-full cases. Based on the determined low-energy constants, we discuss the pion-nucleon sigma term. Additionally, in order to determine the strangeness content of the nucleon, we calculate the octet baryon masses in the presence of decuplet resonances up to next-to-next-to-leading order in SU(3) baryon chiral perturbation theory. The octet baryon sigma terms are predicted as a byproduct of this calculation.