This play is full of contradictions. It seems to propose an ethics of moral Christian values and does so at times. And in spite of Shylock's intent on revenge, he is discriminated against by virtually all other characters. Portia is also somewhat hypocritical. She shows some discrimination against some of her suitors and is less than merciful in the end with Shylock. Although, it could be argued that she is so intelligent that she knew how her scheme would play out. In the end, justice is done to an extent, but to be sure, commanding that Shylock commit to becoming a Christian is hardly justified. (This was a group decision but one initiated by Portia's manipulations.)
That all being said, Portia is genuine in her love for Bassanio and does seek justice in the end. While Shylock is right by law to expect his return, she is right to challenge his vengeance against Antonio and find a way to save Antonio, even if it might seem to serve her benefit as well.
In Act 3, Scene 4, she shows these good virtues and even calls attention to the fact that she does these things for her own sake (or the certainty that she and Bassanio will end up together, but also to make certain that the other couples will have the same happy ending: Jessica and Lorenzo, Gratiano and Nerissa). In this scene, we see the goodness of her virtue and a hint at how intelligent she will prove to be. She tells Lorenzo that she is glad she's done the right thing. She logically concludes that if Antonio is anything like Bassanio, he must be a virtuous man and therefore worth saving. Therefore, money is no object; this is what separates her from Shylock. He speaks more of money than love and she, the opposite:
How little is the cost I have bestow'd,
In purchasing the semblance of my soul (III.iv.19-20)
This comes too near the praising of myself,
Therefore, no more of it: hear other things. (III.iv.22-23)
She feels confident in having done the right thing but shows some humility here by stopping when it seems she is praising herself too much. Having caught a glimpse of her own happy ending, she shows some renewed confidence in her abilities and in her certainty that she is doing the right thing.