Amorphous magnetic Ni-Co-B nanoparticles with an average size of 5 nm were added to precursor powders of MgB2 superconductor. The preparation procedure for MgB2 pellets was optimized for obtaining the best critical current density (Jc) at elevated magnetic fields. Addition of Ni-Co-B decreases the Jc for heat treatment of precursor powders at 650 ° C. Heat treatments at 770 ° C and higher improve Jc at 20 and 5 K. This improvement occurs at both temperatures through the increase of the effective connectivity between MgB2 crystals. Vortex pinning was enhanced at 5 K, but not at 20 K. Ni-Co-B nanoparticles reacted with Mg in heat treatments above 730 ° C, forming Mg2Ni and MgCo2 nanoparticles. Ni-Co-B addition was associated with lower oxygen content in MgB2, indicating that reduction of MgO content is the mechanism for improvement of grain connectivity. Decomposition of magnetic Ni-Co-B nanoparticles results mostly in non-magnetic nanoparticles, so magnetic pinning did not occur in our samples. © 2013 IOP Publishing Ltd.