I don't think it has to be the exact words to be plagiarism, but it has to be sufficiently similar, in substantial amounts. There was a famous case recently of a young woman whose first novel bore a striking resemblance to a published work. IIRC correctly, not only was the basic plot the same, but at equivalent points in the story, the sentences were worded very similarly.
To take a made-up example that might be familiar to many, let's say you write a space opera about a farm boy who dreams of being a pilot, and who joins a rebellion after the Evil Empire murder his family. So far it's not plagiarism, it's just a bit derivative. If the rest of your story is completely different from the plot of "Star Wars", no-one is likely to mind - or at least, not much. George Lucas can't sue you for borrowing a couple of plot points.
However if you start adding in a feisty princess, a pair of comedy robots and a cyborg villain, you're heading into plagiarism territory (unless it's parody, in which case you're OK). Likewise, if your plot is original but, when your protagonist Mark goes into the spaceport bar, you have a section of dialogue like this:
'He doesn't like you.'
'I'm sorry.' Mark turned away.
'I don't like you either,' the alien said, grabbing Mark's shoulder. 'You just watch yourself. We're wanted men. I have the death sentence on twenty planets.
'I'll be careful.'
'You'll be dead!'
- that's also plagiarism (even though I changed one sentence slightly).
HTH
Anne