Dynamic instability of viscoelastic porous functionally graded (FG) nanobeam embedded on visco-Pasternak medium subjected to an axially oscillating loading as well as magnetic field is presented in this research. Porosity-dependent material properties of the porous nanobeam are described via a modified power-law function. Viscoelasticity of the nanostructure is considered based on the Kelvin–Voigt model. Employing Eringen's differential law in conjunction with Timoshenko beam theory (TBT), the motion equations are derived via Hamilton's variational principle. Navier's solution as well as Bolotin's approach are utilized to obtain the dynamic instability region of viscoelastic porous FG nanobeam. Some benchmark results related to the effects of structural damping, length to thickness ratio, foundation type, nonlocal parameter (NP), static load factor, power-law index, porosity volume index and magnetic field on the instability region of porous FG nanobeam are evaluated. The results reveal that with increasing power-law index and structural damping, the pulsation frequency decreases and so, instability region shifts to left side while as magnetic field magnifies, the dynamic instability moves to right side. Also, it is represented that the porosity effect on the dynamic stability of FG nanobeam depends significantly on the values of power-low index and magnetic field.