As a comedy - at least at first. This is the only real scene of 'comic relief' in this play. Most of Shakespeare's tragedies have more than one comic interlude -or at least a longer one: the Gravedigger scene in Hamlet; the gulling of Roderigo by Iago in Othello: Lear's Fool provides this relief from the tragic tension, as does the Nurse in Romeo & Juliet. Marlowe relies on comic scenes in Dr Faustus. (This was just one of the ways in which English Renaissance drama differed from the Greek classical, in which comedy was not allowed.) These scenes often involve a cheerful bawdiness at odds with the serious tone of the rest of the play.
The 'devil-porter' role derives from fourteenth century miracle plays. These traditional cycles disappeared gradually during the sixteenth century, but survived in popular memory long after they were banned by the reformed church. Macbeth's Porter seems to combine the role of one of the devils at the gate of Hell, ushering in Christ and the damned when Christ descended, and a parody of St Peter at the gate of Heaven - since traditionally (and in the miracle plays) the damned do not seek admission into Hell.
There is much play on the word 'equivocator': ie, someone who does not tell the whole truth, or speaks ambiguously. This is likely a reference to Catholics being urged to 'equivocate' while being interrogated and avoid persecution. The Porter then makes a joke of drink being an 'equivocator' with lechery - misleading a man into sexual desire, while robbing him of the physical capability.
The scene quickly gives way to seriousness with the entry of Macbeth, seemingly innocent - he sends Macduff to wake the King, and the audience knows what he will find. Lennox relates the ominous things he has seen and heard ('strange screams of death', the earth-tremor, his chimney blowing out) and now any comedy evaporates with Macduff's 'Horror, horror, horror!' The scene continues with Macbeth's pretended surprise, and the general response to the shocking news - including Macbeth's announcement that he has killed the guards - who, as the audience knows, are the only possible witnesses to the crime, as well as convenient scapegoats for it.
This scene marks a distinct moment in the play, partly because the murder is now 'public', and partly because almost all the main players are present on stage. This scene would need to be played with a lightning development from comedy to tragedy, and do justice dramatically to both elements.