I assume that you are referring to Act IV, scene i, when Portia appears at the Venetian court, disguised as a young doctor of law, to argue the case brought before the Duke concerning Antonio's inability to repay Shylock the money loaned him. Shylock requires a pound of flesh from the body of Antonio nearest the heart in recompense.
Portia does a few things to solve this problem and save Antonio. First she pleads to Shylock to have mercy upon Antonio and forgive him the bond. In a long speech on the value and quality of mercy, she says:
. . . Therefore, Jew,
Though justice be thy plea, consider this,
That in the course of justice, none of us
Should see salvation. We do pray for mercy,
And that same prayer doth teach us all to render
The deeds of mercy.
Shylock does not heed this and still demands his pound of flesh. And so, Portia takes another tack. She tells Shylock to proceed in taking his bond, yet she cautions him to take only flesh:
The words expressly are "a pound of flesh."
Take then thy bond, take thou thy pound of flesh.
But, in the cutting it, if thou dost shed
One drop of Christian blood, thy lands and goods
Are, by the laws of Venice, confiscate
Unto the state of Venice.
So, Shylock does not take Antonio's flesh. And, before he can escape the courtroom, Portia takes this a step further by telling Shylock, that by attempting to "seek the life of [a] citizen" of Venice, he (Shylock), because he is a Jew (so not a citizen) is subject to the Duke's judgement in whether he himself should be put to death. And the Duke, in his mercy, grants Shylock his life, but strips him of all his property.
So, not only does Portia solve the problem of saving Antonio from Shylock's bond, she also manages to make sure that Shylock himself is punished.
For more on this scene, please follow the links below.