How to treat an under-performing coauthor? I am a postdoctoral researcher in a lab, having person (e.g.) X as a colleague, also a postdoctoral researcher like me, having obtained a PhD two years after me.

Here is the problem: In the last two years, I have taken initiatives that have led to a number of publications. My collaboration with X was not so close, since I ended up doing 80% of the work, in addition to having the original ideas, and he/she was only helping by e.g. writing a Section, having general discussions, or giving general comments.

I have tried "pushing" (with frequent emails, meetings etc.) but it did not have a good result, as I understand that he/she does not feel motivated by me: the result has included some "ugly" emails, not an oral though.

I have been doing this, waiting that in exchange, X would include me as a coauthor in one of the papers that would occur from his/her research (none so far and nothing in-progress from their part, as far as I know).

How to treat this person, given that he/she will not leave, as the professor seems to have some special interest in them.

In my domain, the order of the authors in publications matters, so in our "joint" publications I am the first author, but is this enough? I am thinking that if we both continue independently we would both lose, but do not know how to motivate him/her. I suppose the pressure has to come from the professor, who let's say that cares but has other more important priorities. I have mentioned the problem to the professor, he/she just told to X that they should produce more, and that's it.

How to handle this situation?
You might simply consider that the current situation is fine: you say that you do get help from your collaborator, so there is little reason to stop working with him or her; you lead the collaboration and, for this, get first authorship. This will earn you much (well deserved) better opportunities; by comparison, your collaborator will have a hard time, because no recent first-author publications will look bad on his or her CV.

You might have wanted a more active collaborator, and it is a good idea to try to help him or her do better, but you just cannot push someone against their will. It is possible that he or she does not have what it takes to handle more core tasks, or that so he or she believes. In this case, pushing too hard would amount to cornering him or her into an impossible situation, no good would happen.

Learn to change what you can (e.g., if you have the option to start another collaboration with someone else it might be a very good idea; if you have another job available with potentially better co-worker, you might want to try it, etc.) and do with what you cannot change. Ultimately, you have the upper hand on your own work, and that is how it is supposed to be.

Ho, and about getting co-authorship in exchange for your work: no one is supposed to give you co-authorship in exchange for anything; you can rather be invited to work on a project, and then this work is what grants co-authorship. I am not sure how you meant it, but giving co-authorship as a mere reward for something unrelated to the publication is a serious academic misconduct.