In this paper, the lateral migration of a neutrally buoyant spherical particle in the pressure-driven rectangular channel flow of an Oldroyd-B fluid is numerically investigated with a fictitious domain method. The aspect ratio of the channel cross-section considered is 1 and 2, respectively. The particle lateral motion trajectories are shown for the bulk Reynolds number ranging from 1 to 100, the ratio of the solvent viscosity to the total viscosity being 0.5, and a Weissenberg number up to 1.5. Our results indicate that the lateral equilibrium positions located on the cross-section midline, diagonal line, corner and channel centreline occur successively as the fluid elasticity is increased, for particle migration in square channel flow with finite fluid inertia. The transition of the equilibrium position depends strongly on the elasticity number (the ratio of the Weissenberg number to the Reynolds number) and weakly on the Reynolds number. The diagonal-line equilibrium position occurs at an elasticity number ranging from roughly 0.001 to 0.02, and can coexist with the midline and corner equilibrium positions. When the fluid inertia is negligibly small, particles migrate towards the channel centreline, or the closest corner, depending on their initial positions and the Weissenberg number, and the corner attractive area first increases and then decreases as the Weissenberg number increases. For particle migration in a rectangular channel with an aspect ratio of 2, the transition of the equilibrium position from the midline, ‘diagonal line’ (the line where two lateral shear rates are equal to each other), off-centre long midline and channel centreline takes place as the Weissenberg number increases at moderate Reynolds numbers. An off-centre equilibrium position on the long midline is observed for a large blockage ratio of 0.3 (i.e. the ratio of the particle diameter to the channel height is 0.3) at a low Reynolds number. This off-centre migration is driven by shear forces, unlike the elasticity-induced rapid inward migration, which is driven by the normal force (pressure or first normal stress difference).