Name two sections which successfully create tension and discuss how they are successful at it?
There are several sections which create tension, so I'll focus on the ones I enjoy most, okay?
The first is, well, the first: the appearance of the ghost. You've got battle-hardened (one assumes) guards standing watch, and a ghost appears. They get someone in authority—Hamlet—and the ghost speaks to him. The appearance of a ghost makes things tense from the start; to have him charge Hamlet with revenge makes the reader/viewer say, "Ah, how will he deal with this?"
The second is a bit later: the play within a play. You've got intrigue happening here, and multiple layers of it. Hamlet's putting on one face for Ophelia, and another for Claudius, and he and Horatio are watching Claudius to see if he's guilty—but he (and we) have to be watching Gertrude too. Does she know? Was she in on it?