Heuristic optimisation provides a robust and efficient approach for solving complex real-world problems. The focus of this research is on a hybrid method combining two heuristic optimisation techniques, particle swarm optimisation (PSO) and electromagnetism-like (EM) mechanism, called PSO-EM, for the global optimisation of functions. This hybrid technique incorporates concepts of PSO and EM and creates individuals in a new generation not only by features of PSO, but also by attraction-repulsion mechanism of EM. A numerical study is carried out using a set of 13 test problems, some of which are inspired by practical applications. Results show that the new algorithm is much more robust and efficient than some existing PSO algorithms.